From f92a1a349160577326e04c97a29d78dbe398e84a Mon Sep 17 00:00:00 2001 From: xjs Date: Mon, 26 May 2025 09:46:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/customFetch.ts | 5 +++++ src/views/login.vue | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/api/customFetch.ts b/src/api/customFetch.ts index 85931ae..1659322 100644 --- a/src/api/customFetch.ts +++ b/src/api/customFetch.ts @@ -1,3 +1,5 @@ +import { useUserStore } from "@/store/user"; + /* * @Author: HideInMatrix * @Date: 2024-07-15 @@ -26,8 +28,11 @@ const apiClient = (method: HttpMethod) => { data?: unknown, options: FetchOptions = {} ): Promise => { + const userStore = useUserStore(); + const accessToken = userStore.getAccessToken const config: FetchOptions = { method, + headers:{ Authorization: `Bearer ${accessToken}`}, ...options, }; diff --git a/src/views/login.vue b/src/views/login.vue index 0bcf180..ac1a96c 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,7 +1,10 @@