feat(route): better refresh
This commit is contained in:
@@ -9,7 +9,6 @@ import Pages from './pages';
|
|||||||
export function WorkspaceContainer() {
|
export function WorkspaceContainer() {
|
||||||
const { workspace_id } = useParams();
|
const { workspace_id } = useParams();
|
||||||
const { user, currentSpaceId } = useUserAndSpaces();
|
const { user, currentSpaceId } = useUserAndSpaces();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
user &&
|
user &&
|
||||||
![currentSpaceId, 'affine2vin277tcmafwq'].includes(workspace_id)
|
![currentSpaceId, 'affine2vin277tcmafwq'].includes(workspace_id)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
} from 'firebase/auth';
|
} from 'firebase/auth';
|
||||||
import { atom, useAtom } from 'jotai';
|
import { atom, useAtom } from 'jotai';
|
||||||
import { useEffect, useMemo } from 'react';
|
import { useEffect, useMemo } from 'react';
|
||||||
import { useLocation, useNavigate } from 'react-router';
|
|
||||||
|
|
||||||
import { useIdentifyUser } from '@toeverything/datasource/feature-flags';
|
import { useIdentifyUser } from '@toeverything/datasource/feature-flags';
|
||||||
import { UserInfo } from '@toeverything/utils';
|
import { UserInfo } from '@toeverything/utils';
|
||||||
@@ -63,15 +62,11 @@ const BRAND_ID = 'AFFiNE';
|
|||||||
|
|
||||||
const _localTrigger = atom<boolean>(false);
|
const _localTrigger = atom<boolean>(false);
|
||||||
const _useUserAndSpacesForFreeLogin = () => {
|
const _useUserAndSpacesForFreeLogin = () => {
|
||||||
const location = useLocation();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const [user, setUser] = useAtom(_userAtom);
|
const [user, setUser] = useAtom(_userAtom);
|
||||||
const [loading, setLoading] = useAtom(_loadingAtom);
|
const [loading, setLoading] = useAtom(_loadingAtom);
|
||||||
const [localTrigger] = useAtom(_localTrigger);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
navigate(`/${BRAND_ID}`);
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user