Refactor MasterDetailMntC.vue for improved readability and consistency
This commit is contained in:
@@ -17,7 +17,7 @@ import { tokenService } from './token'
|
||||
// 注意:
|
||||
// - Store 仍然是唯一負責「寫入/清除 token」的地方(login/logout)
|
||||
// - Interceptor 只負責「讀取 token 並附加到 request」
|
||||
export function setupInterceptors (client: AxiosInstance) {
|
||||
export function setupInterceptors(client: AxiosInstance) {
|
||||
// Request: 自動注入 token
|
||||
client.interceptors.request.use(
|
||||
(config) => {
|
||||
@@ -97,8 +97,8 @@ export function setupInterceptors (client: AxiosInstance) {
|
||||
break
|
||||
}
|
||||
default:
|
||||
// 無 response status 時,多半是網路/跨網域/連線問題:
|
||||
// 交由呼叫端決定 UI(snackbar/區塊錯誤/重試),避免全域導頁打斷使用者操作
|
||||
// 無 response status 時,多半是網路/跨網域/連線問題:
|
||||
// 交由呼叫端決定 UI(snackbar/區塊錯誤/重試),避免全域導頁打斷使用者操作
|
||||
}
|
||||
|
||||
const shouldToast =
|
||||
@@ -113,7 +113,7 @@ export function setupInterceptors (client: AxiosInstance) {
|
||||
if (shouldToast) {
|
||||
emitHttpToast({
|
||||
level: status ? 'error' : 'warning',
|
||||
message: normalized.message
|
||||
message: normalized.message,
|
||||
})
|
||||
}
|
||||
return Promise.reject(normalized)
|
||||
|
||||
Reference in New Issue
Block a user