refactor: 前端登录/权限/界面状态迁移至 zustand
This commit is contained in:
@@ -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}` },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user