统一应用初始化

feature/price_manager
Jimmy Liow 1 year ago
parent 51aa59abe1
commit a3d02f4caf

@ -46,11 +46,13 @@ import './i18n';
const { loginToken, userId } = usingStorage() const { loginToken, userId } = usingStorage()
const initAppliction = async () => { const initAppliction = async () => {
if (isNotEmpty(loginToken)) { if (isNotEmpty(loginToken)) {
appendRequestParams('token', loginToken) appendRequestParams('token', loginToken)
} }
if (isNotEmpty(userId)) { if (isNotEmpty(userId)) {
appendRequestParams('wu_id', userId)
await fireAuth() await fireAuth()
} }
} }

@ -32,7 +32,7 @@ function App() {
const [validateUserPassword, tokenTimeout, isPermitted] = useAuthStore( const [validateUserPassword, tokenTimeout, isPermitted] = useAuthStore(
(state) => [state.validateUserPassword, state.tokenTimeout, state.isPermitted]) (state) => [state.validateUserPassword, state.tokenTimeout, state.isPermitted])
const { loginToken, userDetail, userId } = usingStorage() const { loginToken } = usingStorage()
const noticeUnRead = useNoticeStore((state) => state.noticeUnRead) const noticeUnRead = useNoticeStore((state) => state.noticeUnRead)
const href = useHref() const href = useHref()
@ -42,10 +42,6 @@ function App() {
// /p... // /p...
const needToLogin = href !== '/login' && isEmpty(loginToken) const needToLogin = href !== '/login' && isEmpty(loginToken)
if (!needToLogin) {
appendRequestParams('token', loginToken)
appendRequestParams('wu_id', userId)
}
useEffect(() => { useEffect(() => {
fetchUserDetail(loginToken) fetchUserDetail(loginToken)
.then(u => { .then(u => {

Loading…
Cancel
Save