Browse Source

fix: fix location no found error (#10047)

pull/10092/head
DaoYuan 4 years ago
committed by GitHub
parent
commit
6474ea1cee
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app.tsx
  2. 2
      src/components/RightContent/AvatarDropdown.tsx

2
src/app.tsx

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

2
src/components/RightContent/AvatarDropdown.tsx

@ -18,7 +18,7 @@ export type GlobalHeaderRightProps = {
*/ */
const loginOut = async () => { const loginOut = async () => {
await outLogin(); await outLogin();
const { search, pathname } = history.location; const { search, pathname } = window.location;
const urlParams = new URL(window.location.href).searchParams; const urlParams = new URL(window.location.href).searchParams;
/** 此方法会跳转到 redirect 参数所在的位置 */ /** 此方法会跳转到 redirect 参数所在的位置 */
const redirect = urlParams.get('redirect'); const redirect = urlParams.get('redirect');

Loading…
Cancel
Save