refactor: 前端登录/权限/界面状态迁移至 zustand

This commit is contained in:
2026-08-04 14:41:27 +08:00
parent ce1dcc07ea
commit f07ffdc64c
39 changed files with 970 additions and 211 deletions

View File

@@ -1,3 +1,5 @@
import { useUserStore } from '../store/user/userStore';
/**
* Download a file from the API as a blob and trigger a browser download.
*
@@ -9,7 +11,7 @@ export async function downloadBlob(endpoint: string, filename: string): Promise<
? '/api'
: `http://localhost:${import.meta.env.VITE_API_PORT || 3002}/api`;
const token = localStorage.getItem('token');
const token = useUserStore.getState().token;
const res = await fetch(`${baseURL}${endpoint}`, {
headers: { Authorization: `Bearer ${token}` },
});