Enhance synchronization logic and offline handling
- Refactor components to support conditional offline and online CRUD operations. - Introduce `addToQueue` mechanism for syncing offline changes to the server. - Add `isChapterContentExist` method and related existence checks in repositories. - Consolidate data structures and streamline book, chapter, character, and guideline synchronization workflows. - Encrypt additional character fields and adjust repository inserts for offline data.
This commit is contained in:
@@ -138,19 +138,11 @@ export default function AddNewBookForm({setCloseForm}: { setCloseForm: Dispatch<
|
||||
};
|
||||
|
||||
let bookId: string;
|
||||
if (!isCurrentlyOffline()) {
|
||||
// Online - call API server
|
||||
bookId = await System.authPostToServer<string>('book/add', {
|
||||
title: title,
|
||||
subTitle: subtitle,
|
||||
type: selectedBookType,
|
||||
summary: summary,
|
||||
serie: 0,
|
||||
publicationDate: publicationDate,
|
||||
desiredWordCount: wordCount,
|
||||
}, token, lang);
|
||||
} else {
|
||||
if (isCurrentlyOffline()) {
|
||||
bookId = await window.electron.invoke<string>('db:book:create', bookData);
|
||||
} else {
|
||||
// Online - call API server
|
||||
bookId = await System.authPostToServer<string>('book/add', bookData, token, lang);
|
||||
}
|
||||
|
||||
if (!bookId) {
|
||||
|
||||
Reference in New Issue
Block a user