MCPcopy
hub / github.com/Narcooo/inkos / handleSpinoffInit

Function handleSpinoffInit

packages/studio/src/pages/ImportManager.tsx:118–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116 };
117
118 const handleSpinoffInit = async () => {
119 if (!spTitle.trim() || !spParent) return;
120 setLoading(true);
121 setStatus("");
122 try {
123 const data = await postApi<{ bookId?: string }>("/spinoff/init", { title: spTitle, parentBookId: spParent, direction: spDirection || undefined });
124 if (data.bookId) {
125 setStatus(`${t("import.creating")}: ${data.bookId}`);
126 await waitForStudioBookReady(data.bookId);
127 setStatus(`${t("import.spinoffDone")}: ${data.bookId}`);
128 invalidateApiPaths(["/api/v1/books", `/api/v1/books/${data.bookId}`]);
129 nav.toBook(data.bookId);
130 }
131 } catch (e) {
132 setStatus(`Error: ${e instanceof Error ? e.message : String(e)}`);
133 }
134 setLoading(false);
135 };
136
137 const handleImitationInit = async () => {
138 if (!imTitle.trim() || !imRef.trim() || !imIdea.trim()) return;

Callers

nothing calls this directly

Calls 3

waitForStudioBookReadyFunction · 0.90
invalidateApiPathsFunction · 0.90
tFunction · 0.85

Tested by

no test coverage detected