change workspacetype to worksopace until

This commit is contained in:
DiamondThree
2023-01-11 16:04:38 +08:00
parent e9b38a2380
commit 8e8e18fdf9
14 changed files with 82 additions and 53 deletions
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import {
PropsWithChildren,
ReactElement,
@@ -31,10 +30,10 @@ const Page: NextPageWithLayout = () => {
<EditorHeader />
<MobileModal />
{currentPage && currentWorkspace && (
{currentPage && currentWorkspace?.blocksuiteWorkspace && (
<DynamicBlocksuite
page={currentPage}
workspace={currentWorkspace}
workspace={currentWorkspace.blocksuiteWorkspace}
setEditor={setEditorHandler}
/>
)}
@@ -52,9 +51,10 @@ const PageDefender = ({ children }: PropsWithChildren) => {
useEffect(() => {
const initPage = async () => {
const pageId = router.query.pageId as string;
const isPageExist = !!currentWorkspace!.meta.pageMetas.find(
p => p.id === pageId
);
const isPageExist =
currentWorkspace?.blocksuiteWorkspace?.meta?.pageMetas.find(
p => p.id === pageId
);
if (!isPageExist) {
await createPage({ pageId });
}
@@ -16,7 +16,8 @@ const WorkspaceIndex = () => {
if (!workspaceLoaded) {
return;
}
const savedPageId = currentWorkspace?.meta.pageMetas[0]?.id;
const savedPageId =
currentWorkspace?.blocksuiteWorkspace?.meta.pageMetas[0]?.id;
if (savedPageId) {
router.replace(`/workspace/${activeWorkspaceId}/${savedPageId}`);
return;