diff --git a/src/stores/Auth.js b/src/stores/Auth.js index 08823d9..5415454 100644 --- a/src/stores/Auth.js +++ b/src/stores/Auth.js @@ -60,7 +60,7 @@ const useAuthStore = create((set, get) => ({ } } const token = await fetchLoginToken() - console.info('token: ' + token) + appendRequestParams('token', token) const fetchUrl = prepareUrl(HT_HOST + '/service-CooperateSOA/GetLinkManInfo') .append('token', token) diff --git a/src/views/App.jsx b/src/views/App.jsx index e4deb94..09f296a 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -16,6 +16,7 @@ import enLocale from 'antd/locale/en_US'; import 'dayjs/locale/zh-cn'; import { BUILD_VERSION, } from '@/config'; import useNoticeStore from '@/stores/Notice'; +import useAuthStore from '@/stores/Auth' const { Header, Content, Footer } = Layout; const { Title } = Typography; @@ -26,10 +27,13 @@ function App() { const [password, setPassword] = useState(''); const { authStore } = useStore(); const { notification } = AntApp.useApp(); - const login = toJS(authStore.login); + + const loginUser = useAuthStore((state) => state.loginUser) + + // const login = toJS(authStore.login); const noticeUnRead = useNoticeStore((state) => state.noticeUnRead); const href = useHref(); - const loginToken = login.token; + const loginToken = loginUser.token; const navigate = useNavigate(); const location = useLocation(); @@ -44,7 +48,7 @@ function App() { }, [location]); const onSubmit = () => { - authStore.valdateUserPassword(login.username, password) + authStore.valdateUserPassword(loginUser.username, password) .then(() => { authStore.fetchUserDetail() .catch(ex => { @@ -96,7 +100,7 @@ function App() { closable={false} maskClosable={false} footer={null} - open={login.timeout} + open={loginUser.timeout} > {t('LoginTimeout')}
{t('LoginTimeoutTip')}
@@ -104,7 +108,7 @@ function App() { setPassword(e.target.value)} onPressEnter={() => onSubmit()} - addonBefore={login.username} /> + addonBefore={loginUser.username} /> @@ -143,7 +147,7 @@ function App() { - {authStore.login.travelAgencyName} + {loginUser.travelAgencyName} @@ -163,7 +167,7 @@ function App() { > e.preventDefault()}> - {authStore.login.username} + {loginUser.username} diff --git a/src/views/Login.jsx b/src/views/Login.jsx index 52648cb..0df1707 100644 --- a/src/views/Login.jsx +++ b/src/views/Login.jsx @@ -31,7 +31,7 @@ function Login() { useEffect (() => { if (loginStatus === 302) { - // navigate("/reservation/newest") + navigate("/reservation/newest") } }, [loginStatus]);