diff --git a/src/app.tsx b/src/app.tsx index a7007d79..16af7a77 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -33,7 +33,7 @@ export async function getInitialState(): Promise<{ return undefined; }; // 如果不是登录页面,执行 - if (history.location.pathname !== loginPath) { + if (window.location.pathname !== loginPath) { const currentUser = await fetchUserInfo(); return { fetchUserInfo, diff --git a/src/components/RightContent/AvatarDropdown.tsx b/src/components/RightContent/AvatarDropdown.tsx index 518961af..9e77f15b 100644 --- a/src/components/RightContent/AvatarDropdown.tsx +++ b/src/components/RightContent/AvatarDropdown.tsx @@ -18,7 +18,7 @@ export type GlobalHeaderRightProps = { */ const loginOut = async () => { await outLogin(); - const { search, pathname } = history.location; + const { search, pathname } = window.location; const urlParams = new URL(window.location.href).searchParams; /** 此方法会跳转到 redirect 参数所在的位置 */ const redirect = urlParams.get('redirect');