feat: full-screen lock when server access is blocked
Gate admin boot on server_reachable and show server-unavailable overlay on API 503 for SuperAdmin kill switch. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,10 @@ import axios from 'axios'
|
||||
import type { AxiosRequestConfig, AxiosResponse } from 'axios'
|
||||
// import { useRouter, useRoute } from 'vue-router'
|
||||
import { getToken, removeToken } from '@/utils/index'
|
||||
import {
|
||||
hideServerUnavailableOverlay,
|
||||
showServerUnavailableOverlay,
|
||||
} from '@/utils/serverUnavailable'
|
||||
import { message } from 'ant-design-vue'
|
||||
//import { isToken } from '@/utils/is'
|
||||
//import router from '@/router'
|
||||
@@ -69,6 +73,7 @@ _axios.interceptors.response.use(
|
||||
// Any status code that lie within the range of 2xx cause this function to trigger
|
||||
// Do something with response data
|
||||
//console.log('this is fulfilled on interceptors.response', response.data)
|
||||
hideServerUnavailableOverlay()
|
||||
return response.data
|
||||
},
|
||||
async function (error) {
|
||||
@@ -79,6 +84,10 @@ _axios.interceptors.response.use(
|
||||
}*/
|
||||
//console.log('this is error on interceptors.response', error.config.meta)
|
||||
//console.log('1111111111', error.response)
|
||||
if (error.response && error.response.status == 503) {
|
||||
showServerUnavailableOverlay('خطا در برقراری ارتباط با سرور')
|
||||
return Promise.reject(error)
|
||||
}
|
||||
if (error.response && error.response.status == 401) {
|
||||
///removeToken()
|
||||
console.log('error')
|
||||
|
||||
Reference in New Issue
Block a user