fix: auto redirect to home page when 401 (#3131)
This commit is contained in:
parent
c2fb45d640
commit
f8b3644029
1 changed files with 9 additions and 2 deletions
|
|
@ -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]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue