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`,