From e60be41b9813b72aa9d6168103f7aa1311234a64 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Fri, 7 Jun 2024 15:59:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E4=BD=BF=E7=94=A8=E7=9A=84=20username?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/Auth.js | 8 +++++--- src/views/App.jsx | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/stores/Auth.js b/src/stores/Auth.js index 6fb65de..9e3d8b8 100644 --- a/src/stores/Auth.js +++ b/src/stores/Auth.js @@ -7,9 +7,10 @@ import { loadPageSpy } from '@/pageSpy' import { useStorage } from '@/hooks/useStorage' -const KEY_LOGIN_TOKEN = 'GH-STR:LOGIN_TOKEN' -const KEY_TRAVEL_AGENCY_ID = 'GH-INT:TRAVEL_AGENCY_ID' -const KEY_USER_ID = 'GH-INT:USER_ID' +const KEY_LOGIN_TOKEN = 'G-STR:LOGIN_TOKEN' +const KEY_TRAVEL_AGENCY_ID = 'G-INT:TRAVEL_AGENCY_ID' +const KEY_USER_ID = 'G-INT:USER_ID' +const KEY_USER_NAME = 'G-STR:USERNAME' const useAuthStore = create((set, get) => ({ @@ -88,6 +89,7 @@ const useAuthStore = create((set, get) => ({ setStorage(KEY_USER_ID, json.Result.LMI_SN) setStorage(KEY_TRAVEL_AGENCY_ID, json.Result.LMI_VEI_SN) + setStorage(KEY_USER_NAME, json.Result.LoginName) // loadPageSpy(`${json.Result.VName}-${json.Result.LoginName}`) // this.startTokenInterval() } else { diff --git a/src/views/App.jsx b/src/views/App.jsx index 8d78031..ce0f282 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -27,7 +27,7 @@ function App() { const [loginUser, validateUserPassword] = useAuthStore((state) => [state.loginUser, state.validateUserPassword]) - const { loginToken } = useStorage() + const { loginToken, username } = useStorage() const noticeUnRead = useNoticeStore((state) => state.noticeUnRead) const href = useHref(); @@ -52,7 +52,7 @@ function App() { }, [location]); const onSubmit = () => { - validateUserPassword(loginUser.username, password) + validateUserPassword(username, password) .catch(ex => { notification.error({ message: `Notification`,