From be8c526a454aa9081000d15f26bebdef8c183aea Mon Sep 17 00:00:00 2001
From: wsj <593216709@qq.com>
Date: Mon, 26 Oct 2026 23:34:23 +0800
Subject: [PATCH] feat: 提交
---
src/api/authHeaders.ts | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/api/authHeaders.ts b/src/api/authHeaders.ts
new file mode 100644
index 0000000..baad39e
--- /dev/null
+++ b/src/api/authHeaders.ts
@@ -0,0 +1,7 @@
+import { useAuthStore } from '@/store/auth';
+
+/** 接口要求 Bearer JWT,从登录态读取 token 生成请求头。 */
+export const getAuthHeaders = () => {
+ const token = useAuthStore.getState().token;
+ return token ? { Authorization: `Bearer ${token}` } : undefined;
+};
--
Gitblit v1.9.3