wsj
3 days ago 0d9778720a5258876079d02bb8603dd202e6b1a8
1
2
3
4
5
6
7
import { useAuthStore } from '@/store/auth';
 
/** 接口要求 Bearer JWT,从登录态读取 token 生成请求头。 */
export const getAuthHeaders = () => {
  const token = useAuthStore.getState().token;
  return token ? { Authorization: `Bearer ${token}` } : undefined;
};