This commit is contained in:
dni ⚡
2025-12-23 10:58:56 +01:00
parent 90d14629d9
commit 574641d432
5 changed files with 3 additions and 88 deletions
+1 -4
View File
@@ -24,7 +24,7 @@
</div>
</template>
<script>
const LnbitsError = {
export default {
props: ['dynamic', 'code', 'message'],
computed: {
isExtension() {
@@ -75,7 +75,4 @@ const LnbitsError = {
}
}
}
// expose to window on the browser
if (typeof window !== 'undefined') window.LnbitsError = LnbitsError
export default LnbitsError
</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
+1 -1
View File
@@ -95,7 +95,7 @@
<!-- scripts from extensions -->
{% block scripts %}{% endblock %}
<!-- modules js -->
<script src="{{ static_url_for('static', 'modules/components.umd.js') }}"></script>
<script src="/static/modules/components.umd.js"></script>
<!-- components js -->
{% for url in INCLUDED_COMPONENTS %}
<script src="{{ static_url_for('static', url) }}"></script>
+1 -2
View File
@@ -29,8 +29,7 @@ include('components/lnbits-wallet-api-docs.vue') %} {%
include('components/lnbits-wallet-share.vue') %} {%
include('components/lnbits-wallet-charts.vue') %} {%
include('components/lnbits-wallet-paylinks.vue') %} {%
include('components/lnbits-wallet-extra.vue') %} {%
include('components/lnbits-error.vue') %}
include('components/lnbits-wallet-extra.vue') %}
<template id="lnbits-manage">
<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>