fix: better differentiation between UNAUTHORIZED and FORBIDDEN (#3139)
This commit is contained in:
+11
-15
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user