Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

페이지 생성 시, DB에 워크스페이스 id가 저장 안되는 버그 #406

Merged
merged 2 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions apps/frontend/src/entities/page/model/pageMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ import { createPage, deletePage } from "../api/pageApi";

export const useCreatePage = () => {
return useMutation({
mutationFn: ({ title, content, x, y, emoji }: CreatePageRequest) =>
createPage({ title, content, x, y, emoji }),
mutationFn: ({
title,
content,
x,
y,
emoji,
workspaceId,
}: CreatePageRequest) =>
createPage({ title, content, x, y, emoji, workspaceId }),
});
};

Expand Down
1 change: 1 addition & 0 deletions apps/frontend/src/entities/page/model/pageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface CreatePageRequest {
emoji: string | null;
x: number;
y: number;
workspaceId: string;
}

export interface CreatePageResponse {
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/src/features/canvasTools/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { CursorButton } from "./ui/CursorButton";
export { NewNodePanel } from "./ui/NewNodePanel";
export { NodePanel } from "./ui/NodePanel";
export { ProfilePanel } from "./ui/ProfilePanel";
71 changes: 0 additions & 71 deletions apps/frontend/src/features/canvasTools/ui/NewNodePanel/index.tsx

This file was deleted.

85 changes: 0 additions & 85 deletions apps/frontend/src/features/pageSidebar/ui/ProfileModal/index.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions apps/frontend/src/features/pageSidebar/ui/Tools/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ import { PencilLine } from "lucide-react";
import { useCreatePage, usePageStore } from "@/entities/page";
import { useYDocStore, initializeYText } from "@/shared/model";
import { Button } from "@/shared/ui";
import { useCurrentWorkspace } from "@/features/workspace";

export function Tools() {
const { setCurrentPage } = usePageStore();
const createMutation = useCreatePage();
const { data } = useCurrentWorkspace();
const { ydoc } = useYDocStore();

return (
<Button
className={`flex w-full flex-row items-center gap-1 rounded-sm px-2 py-1 font-medium hover:bg-neutral-100`}
onClick={() => {
if (!data) return;

createMutation
.mutateAsync({
title: "제목 없음",
Expand All @@ -28,6 +32,7 @@ export function Tools() {
x: 0,
y: 0,
emoji: null,
workspaceId: data.workspace.workspaceId,
})
.then((res) => {
const nodesMap = ydoc.getMap("nodes");
Expand Down
Loading