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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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