diff --git a/src/app/stories/[storyId]/edit/_components/EditStorySwitchMode.tsx b/src/app/stories/[storyId]/edit/_components/EditStorySwitchMode.tsx index 91ad4f55..a5f16dcc 100644 --- a/src/app/stories/[storyId]/edit/_components/EditStorySwitchMode.tsx +++ b/src/app/stories/[storyId]/edit/_components/EditStorySwitchMode.tsx @@ -8,11 +8,11 @@ import { useSearchParams } from "next/navigation"; export const EditStorySwitchMode = ({ story, device, - onSubmit, + saveStory, }: { story: Story; device: Device; - onSubmit: (data: StoryInit) => Promise; + saveStory: (data: StoryInit) => Promise; }) => { const searchParams = useSearchParams(); const mode = searchParams?.get("mode"); @@ -23,7 +23,7 @@ export const EditStorySwitchMode = ({ title: story.title, id: story.id, }} - onSubmit={onSubmit} + saveStory={saveStory} /> ); } else { @@ -32,7 +32,7 @@ export const EditStorySwitchMode = ({ storyId={story.id} story={story} device={device} - onSubmit={onSubmit} + saveStory={saveStory} /> ); } diff --git a/src/app/stories/[storyId]/edit/page.tsx b/src/app/stories/[storyId]/edit/page.tsx index 42d8f90b..a80d432d 100644 --- a/src/app/stories/[storyId]/edit/page.tsx +++ b/src/app/stories/[storyId]/edit/page.tsx @@ -57,7 +57,7 @@ export default async function StoryEditPage({ params }: { params: unknown }) { { + saveStory={async (input) => { "use server"; const ok = await updateStory({ storyId, diff --git a/src/components/editStory/index.tsx b/src/components/editStory/index.tsx index 16da4c75..0d168170 100644 --- a/src/components/editStory/index.tsx +++ b/src/components/editStory/index.tsx @@ -18,16 +18,16 @@ export type Props = { storyId: string; story: StoryInit; device: Device; - onSubmit: (data: StoryInit) => Promise; + saveStory: (data: StoryInit) => Promise; }; export const EditStory: React.FC = ({ storyId, story, device, - onSubmit, + saveStory, }) => { - const { isLoading, mutate, isError } = useMutation(onSubmit); + const { isLoading, mutate, isError } = useMutation(saveStory); const router = useRouter(); return (
diff --git a/src/components/editStoryYaml/index.tsx b/src/components/editStoryYaml/index.tsx index 3c88caf8..a1a1f84f 100644 --- a/src/components/editStoryYaml/index.tsx +++ b/src/components/editStoryYaml/index.tsx @@ -15,10 +15,10 @@ export const EditStoryYaml: React.FC<{ title: string; id: string; }; - onSubmit: (data: StoryInit) => Promise; -}> = ({ story, onSubmit }) => { + saveStory: (data: StoryInit) => Promise; +}> = ({ story, saveStory }) => { const router = useRouter(); - const { mutate, isIdle } = useMutation(onSubmit); + const { mutate, isIdle } = useMutation(saveStory); const storyId = story.id; const handleFileRead = useCallback(