Refactor IPC handlers, types, and models for streamlined data handling

- Unified return types across IPC handlers (`Character`, `Location`, `World`, and `Book`) for consistency.
- Replaced `BookListProps` with `BookProps` for simplified type usage in components and handlers.
- Cleaned up obsolete `BookListProps` interface and applied consistent typings throughout.
- Updated imports to include revised response types (`CharacterListResponse`, `LocationListResponse`, `WorldListResponse`).
- Adjusted data transformation logic in `BookList` and related components to align with new type definitions.
This commit is contained in:
natreex
2026-01-15 16:12:20 -05:00
parent e45a15225b
commit 3d4feaa680
6 changed files with 33 additions and 50 deletions

View File

@@ -9,7 +9,7 @@ import {faGear, faGlobe, faHome} from "@fortawesome/free-solid-svg-icons";
import {SelectBoxProps} from "@/shared/interface";
import {AlertContext} from "@/context/AlertContext";
import {SessionContext} from "@/context/SessionContext";
import Book, {BookListProps} from "@/lib/models/Book";
import Book, {BookProps} from "@/lib/models/Book";
import Modal from "@/components/Modal";
import BookSetting from "@/components/book/settings/BookSetting";
import SelectBox from "@/components/form/SelectBox";
@@ -61,7 +61,7 @@ export default function ScribeControllerBar() {
async function getBook(bookId: string): Promise<void> {
try {
const response: BookListProps = await System.authGetQueryToServer<BookListProps>(`book/basic-information`, session.accessToken, lang, {
const response: BookProps = await System.authGetQueryToServer<BookProps>(`book/basic-information`, session.accessToken, lang, {
id: bookId,
});
if (!response) {
@@ -69,12 +69,12 @@ export default function ScribeControllerBar() {
return;
}
setBook!!({
bookId: response.id,
bookId: response.bookId,
type: response.type,
title: response.title,
subTitle: response.subTitle,
summary: response.summary,
publicationDate: response.desiredReleaseDate,
publicationDate: response.publicationDate,
desiredWordCount: response.desiredWordCount,
totalWordCount: response.desiredWordCount,
quillsenseEnabled: response.quillsenseEnabled,