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:
@@ -1,6 +1,6 @@
|
||||
import { ipcMain } from 'electron';
|
||||
import { createHandler } from '../database/LocalSystem.js';
|
||||
import Location from '../database/models/Location.js';
|
||||
import Location, {LocationListResponse} from '../database/models/Location.js';
|
||||
import type { LocationProps } from '../database/models/Location.js';
|
||||
|
||||
interface UpdateLocationResponse {
|
||||
@@ -34,8 +34,8 @@ interface UpdateLocationData {
|
||||
interface GetAllLocationsData {
|
||||
bookid: string;
|
||||
}
|
||||
ipcMain.handle('db:location:all', createHandler<GetAllLocationsData, LocationProps[]>(
|
||||
function(userId: string, data: GetAllLocationsData, lang: 'fr' | 'en'): LocationProps[] {
|
||||
ipcMain.handle('db:location:all', createHandler<GetAllLocationsData, LocationListResponse>(
|
||||
function(userId: string, data: GetAllLocationsData, lang: 'fr' | 'en'): LocationListResponse {
|
||||
return Location.getAllLocations(userId, data.bookid, lang);
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user