()
| 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; |
nothing calls this directly
no test coverage detected