Skip to content

Commit 580c1c6

Browse files
committed
fix: 페이지 생성 시, 워크스페이스 id 전달
1 parent 12af4d4 commit 580c1c6

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

apps/frontend/src/entities/page/model/pageMutations.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ import { createPage, deletePage } from "../api/pageApi";
55

66
export const useCreatePage = () => {
77
return useMutation({
8-
mutationFn: ({ title, content, x, y, emoji }: CreatePageRequest) =>
9-
createPage({ title, content, x, y, emoji }),
8+
mutationFn: ({
9+
title,
10+
content,
11+
x,
12+
y,
13+
emoji,
14+
workspaceId,
15+
}: CreatePageRequest) =>
16+
createPage({ title, content, x, y, emoji, workspaceId }),
1017
});
1118
};
1219

apps/frontend/src/entities/page/model/pageTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface CreatePageRequest {
2323
emoji: string | null;
2424
x: number;
2525
y: number;
26+
workspaceId: string;
2627
}
2728

2829
export interface CreatePageResponse {

apps/frontend/src/features/pageSidebar/ui/Tools/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ import { PencilLine } from "lucide-react";
33
import { useCreatePage, usePageStore } from "@/entities/page";
44
import { useYDocStore, initializeYText } from "@/shared/model";
55
import { Button } from "@/shared/ui";
6+
import { useCurrentWorkspace } from "@/features/workspace";
67

78
export function Tools() {
89
const { setCurrentPage } = usePageStore();
910
const createMutation = useCreatePage();
11+
const { data } = useCurrentWorkspace();
1012
const { ydoc } = useYDocStore();
1113

1214
return (
1315
<Button
1416
className={`flex w-full flex-row items-center gap-1 rounded-sm px-2 py-1 font-medium hover:bg-neutral-100`}
1517
onClick={() => {
18+
if (!data) return;
19+
1620
createMutation
1721
.mutateAsync({
1822
title: "제목 없음",
@@ -28,6 +32,7 @@ export function Tools() {
2832
x: 0,
2933
y: 0,
3034
emoji: null,
35+
workspaceId: data.workspace.workspaceId,
3136
})
3237
.then((res) => {
3338
const nodesMap = ydoc.getMap("nodes");

0 commit comments

Comments
 (0)