fix: close business flow regressions
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
/** 气站后台 HTTP 客户端,使用独立 API 前缀和 JWT 存储键。 */
|
||||
const apiBaseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:12426/heqi/gas/v1';
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
export const tokenStorageKey = 'gas_admin_token';
|
||||
const apiBaseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:12426/heqi/gas/v1';
|
||||
|
||||
export type PageResult<T> = { total: number; list: T[] };
|
||||
|
||||
export async function request<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
const token = localStorage.getItem(tokenStorageKey);
|
||||
const token = getToken();
|
||||
let response: Response;
|
||||
try {
|
||||
response = await fetch(`${apiBaseURL}${path}`, {
|
||||
|
||||
@@ -37,7 +37,10 @@ export default function setupPermissionGuard(router: Router) {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (exist && permissionsAllow) {
|
||||
const menuCode = to.meta.menuCode;
|
||||
const grantedByMenuCode =
|
||||
typeof menuCode === 'string' && userStore.menuCodes.includes(menuCode);
|
||||
if ((exist || grantedByMenuCode) && permissionsAllow) {
|
||||
next();
|
||||
} else next(NOT_FOUND);
|
||||
} else if (permissionsAllow) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const TOKEN_KEY = 'token';
|
||||
const TOKEN_KEY = 'gas_admin_token';
|
||||
|
||||
const isLogin = () => {
|
||||
return !!localStorage.getItem(TOKEN_KEY);
|
||||
|
||||
Reference in New Issue
Block a user