fix: better differentiation between UNAUTHORIZED and FORBIDDEN (#3139)

This commit is contained in:
Vlad Stan
2025-05-05 10:55:58 +02:00
committed by GitHub
parent 6a9089fd98
commit 3529f9152f
7 changed files with 39 additions and 45 deletions
+11 -15
View File
@@ -65,19 +65,15 @@
goToExtension() {
window.location.href = `/extensions#${this.extension}`
},
logOut() {
LNbits.utils
.confirmDialog(
'Do you really want to logout?'
)
.onOk( async () => {
try {
await LNbits.api.logout()
window.location = '/'
} catch (e) {
LNbits.utils.notifyApiError(e)
}
})
async logOut() {
try {
await LNbits.api.logout()
window.location = '/'
} catch (e) {
LNbits.utils.notifyApiError(e)
}
},
},
computed: {
@@ -86,13 +82,13 @@
if (this.message.startsWith('Extension ')) return true
}
},
created() {
async created() {
this.err = '{{ err }}'
const statusCode = '{{ status_code }}' || 404
this.message = String({{ message | tojson }}) || 'Page not found'
if (statusCode == 401) {
console.warn(`Unauthorized: ${this.message}`)
this.goHome()
this.logOut()
return
}
this.statusCode = statusCode