mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
22 lines
646 B
TypeScript
22 lines
646 B
TypeScript
import { useEffect } from 'react';
|
|
import { useRouter } from 'next/router';
|
|
import { useAppState } from '@/providers/app-state-provider';
|
|
import useEnsureWorkspace from '@/hooks/use-ensure-workspace';
|
|
import { PageLoading } from '@/components/loading';
|
|
|
|
export const WorkspaceIndex = () => {
|
|
const router = useRouter();
|
|
const { currentWorkspaceId } = useAppState();
|
|
const { workspaceLoaded } = useEnsureWorkspace();
|
|
|
|
useEffect(() => {
|
|
if (workspaceLoaded) {
|
|
router.push(`/workspace/${currentWorkspaceId}`);
|
|
}
|
|
}, [currentWorkspaceId, router, workspaceLoaded]);
|
|
|
|
return <PageLoading />;
|
|
};
|
|
|
|
export default WorkspaceIndex;
|