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:
2026-08-11 15:51:13 +03:30
co-authored by Cursor
parent 7c58501268
commit 512756348b
3 changed files with 106 additions and 3 deletions
+9
View File
@@ -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')