Add error handling, enhance syncing, and refactor deletion logic
- Introduce new error messages for syncing and book deletion in `en.json`. - Update `DeleteBook` to support local-only deletion and synced book management. - Refine offline/online behavior with `deleteLocalToo` checkbox and update related state handling. - Extend repository and IPC methods to handle optional IDs for updates. - Add `SyncQueueContext` for queueing offline changes and improving synchronization workflows. - Enhance refined text generation logic in `DraftCompanion` and `GhostWriter` components. - Replace PUT with PATCH for world updates to align with API expectations. - Streamline `AlertBox` by integrating dynamic translation keys for deletion prompts.
This commit is contained in:
@@ -11,16 +11,19 @@ interface UpdateLocationResponse {
|
||||
interface AddLocationSectionData {
|
||||
locationName: string;
|
||||
bookId: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface AddLocationElementData {
|
||||
locationId: string;
|
||||
elementName: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface AddLocationSubElementData {
|
||||
elementId: string;
|
||||
subElementName: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface UpdateLocationData {
|
||||
@@ -41,7 +44,7 @@ ipcMain.handle('db:location:all', createHandler<GetAllLocationsData, LocationPro
|
||||
// POST /location/section/add - Add location section
|
||||
ipcMain.handle('db:location:section:add', createHandler<AddLocationSectionData, string>(
|
||||
function(userId: string, data: AddLocationSectionData, lang: 'fr' | 'en'): string {
|
||||
return Location.addLocationSection(userId, data.locationName, data.bookId, lang);
|
||||
return Location.addLocationSection(userId, data.locationName, data.bookId, lang, data.id);
|
||||
}
|
||||
)
|
||||
);
|
||||
@@ -49,7 +52,7 @@ ipcMain.handle('db:location:section:add', createHandler<AddLocationSectionData,
|
||||
// POST /location/element/add - Add location element
|
||||
ipcMain.handle('db:location:element:add', createHandler<AddLocationElementData, string>(
|
||||
function(userId: string, data: AddLocationElementData, lang: 'fr' | 'en'): string {
|
||||
return Location.addLocationElement(userId, data.locationId, data.elementName, lang);
|
||||
return Location.addLocationElement(userId, data.locationId, data.elementName, lang, data.id);
|
||||
}
|
||||
)
|
||||
);
|
||||
@@ -57,7 +60,7 @@ ipcMain.handle('db:location:element:add', createHandler<AddLocationElementData,
|
||||
// POST /location/sub-element/add - Add location sub-element
|
||||
ipcMain.handle('db:location:subelement:add', createHandler<AddLocationSubElementData, string>(
|
||||
function(userId: string, data: AddLocationSubElementData, lang: 'fr' | 'en'): string {
|
||||
return Location.addLocationSubElement(userId, data.elementId, data.subElementName, lang);
|
||||
return Location.addLocationSubElement(userId, data.elementId, data.subElementName, lang, data.id);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user