fix: auto redirect to home page when 401 (#3131)

This commit is contained in:
Vlad Stan
2025-04-29 15:28:04 +03:00
committed by GitHub
parent c2fb45d640
commit f8b3644029

View File

@@ -6,7 +6,7 @@
>
{% block page %}
<div class="text-center q-pa-md flex flex-center">
<div>
<div v-if="statusCode">
<div class="error-code" v-text="statusCode"></div>
<div class="error-message" v-text="message"></div>
@@ -88,8 +88,15 @@
},
created() {
this.err = '{{ err }}'
this.statusCode = '{{ status_code }}' || 404
const statusCode = '{{ status_code }}' || 404
this.message = String({{ message | tojson }}) || 'Page not found'
if (statusCode == 401) {
console.warn(`Unauthorized: ${this.message}`)
this.goHome()
return
}
this.statusCode = statusCode
if (this.isExtension) {
this.extension = this.message.match(/'([^']+)'/)[1]
}