fixup!
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
const LnbitsError = {
|
export default {
|
||||||
props: ['dynamic', 'code', 'message'],
|
props: ['dynamic', 'code', 'message'],
|
||||||
computed: {
|
computed: {
|
||||||
isExtension() {
|
isExtension() {
|
||||||
@@ -75,7 +75,4 @@ const LnbitsError = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// expose to window on the browser
|
|
||||||
if (typeof window !== 'undefined') window.LnbitsError = LnbitsError
|
|
||||||
export default LnbitsError
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
const LnbitsError = {
|
|
||||||
template: '#lnbits-error',
|
|
||||||
props: ['dynamic', 'code', 'message'],
|
|
||||||
computed: {
|
|
||||||
isExtension() {
|
|
||||||
if (this.code != 403) return false
|
|
||||||
if (this.message.startsWith('Extension ')) return true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
goBack() {
|
|
||||||
window.history.back()
|
|
||||||
},
|
|
||||||
goHome() {
|
|
||||||
window.location = '/'
|
|
||||||
},
|
|
||||||
goToWallet() {
|
|
||||||
if (this.dynamic) {
|
|
||||||
this.$router.push('/wallet')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
window.location = '/wallet'
|
|
||||||
},
|
|
||||||
goToExtension() {
|
|
||||||
const extension = this.message.match(/'([^']+)'/)[1]
|
|
||||||
const url = `/extensions#${extension}`
|
|
||||||
if (this.dynamic) {
|
|
||||||
this.$router.push(url)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
window.location = url
|
|
||||||
},
|
|
||||||
async logOut() {
|
|
||||||
try {
|
|
||||||
await LNbits.api.logout()
|
|
||||||
window.location = '/'
|
|
||||||
} catch (e) {
|
|
||||||
LNbits.utils.notifyApiError(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async created() {
|
|
||||||
// check if we have error from error.html
|
|
||||||
if (!this.dynamic) {
|
|
||||||
if (this.code == 401) {
|
|
||||||
console.warn(`Unauthorized: ${this.errorMessage}`)
|
|
||||||
this.logOut()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// expose to window on the browser
|
|
||||||
if (typeof window !== 'undefined') window.LnbitsError = LnbitsError
|
|
||||||
|
|
||||||
export default LnbitsError
|
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
<!-- scripts from extensions -->
|
<!-- scripts from extensions -->
|
||||||
{% block scripts %}{% endblock %}
|
{% block scripts %}{% endblock %}
|
||||||
<!-- modules js -->
|
<!-- modules js -->
|
||||||
<script src="{{ static_url_for('static', 'modules/components.umd.js') }}"></script>
|
<script src="/static/modules/components.umd.js"></script>
|
||||||
<!-- components js -->
|
<!-- components js -->
|
||||||
{% for url in INCLUDED_COMPONENTS %}
|
{% for url in INCLUDED_COMPONENTS %}
|
||||||
<script src="{{ static_url_for('static', url) }}"></script>
|
<script src="{{ static_url_for('static', url) }}"></script>
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ include('components/lnbits-wallet-api-docs.vue') %} {%
|
|||||||
include('components/lnbits-wallet-share.vue') %} {%
|
include('components/lnbits-wallet-share.vue') %} {%
|
||||||
include('components/lnbits-wallet-charts.vue') %} {%
|
include('components/lnbits-wallet-charts.vue') %} {%
|
||||||
include('components/lnbits-wallet-paylinks.vue') %} {%
|
include('components/lnbits-wallet-paylinks.vue') %} {%
|
||||||
include('components/lnbits-wallet-extra.vue') %} {%
|
include('components/lnbits-wallet-extra.vue') %}
|
||||||
include('components/lnbits-error.vue') %}
|
|
||||||
|
|
||||||
<template id="lnbits-manage">
|
<template id="lnbits-manage">
|
||||||
<q-list v-if="g.user" dense class="lnbits-drawer__q-list">
|
<q-list v-if="g.user" dense class="lnbits-drawer__q-list">
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
<template id="lnbits-error">
|
|
||||||
<div class="text-center q-pa-md flex flex-center">
|
|
||||||
<div>
|
|
||||||
<div class="error-code" v-text="code"></div>
|
|
||||||
<div class="error-message" v-text="message"></div>
|
|
||||||
<div class="q-mx-auto q-mt-lg justify-center" style="width: max-content">
|
|
||||||
<q-btn
|
|
||||||
v-if="isExtension"
|
|
||||||
color="primary"
|
|
||||||
@click="goToExtension()"
|
|
||||||
label="Go To Extension"
|
|
||||||
></q-btn>
|
|
||||||
<q-btn
|
|
||||||
v-else-if="g.isUserAuthorized"
|
|
||||||
color="primary"
|
|
||||||
@click="goToWallet()"
|
|
||||||
label="Go to Wallet"
|
|
||||||
></q-btn>
|
|
||||||
<q-btn v-else color="primary" @click="goBack()" label="Go Back"></q-btn>
|
|
||||||
<span class="q-mx-md">OR</span>
|
|
||||||
<q-btn color="secondary" @click="goHome()" label="Go Home"></q-btn>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
Reference in New Issue
Block a user