Browse Source

fix: Hash router was ignored in getInitialState() (#10352)

Use `history.location.pathname` instead of `window.location.pathname` to support hash router.
pull/10404/head
SHINCHVEN 3 years ago
committed by GitHub
parent
commit
9d018aae5c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/app.tsx

3
src/app.tsx

@ -33,7 +33,8 @@ export async function getInitialState(): Promise<{
return undefined; return undefined;
}; };
// 如果不是登录页面,执行 // 如果不是登录页面,执行
if (window.location.pathname !== loginPath) { const { location } = history;
if (location.pathname !== loginPath) {
const currentUser = await fetchUserInfo(); const currentUser = await fetchUserInfo();
return { return {
fetchUserInfo, fetchUserInfo,

Loading…
Cancel
Save