Integrate session management, multilingual IPC handlers, and Book database operations
- Add `LocalSystem` with handlers for session retrieval (`userId`, `lang`) and error handling. - Extend IPC handlers to support multilingual operations (`fr`, `en`) and session data injection
This commit is contained in:
@@ -129,8 +129,19 @@ ipcMain.handle('remove-token', () => {
|
||||
return true;
|
||||
});
|
||||
|
||||
ipcMain.on('login-success', (_event, token: string) => {
|
||||
// IPC Handlers pour la gestion de la langue
|
||||
ipcMain.handle('get-lang', () => {
|
||||
return store.get('userLang', 'fr');
|
||||
});
|
||||
|
||||
ipcMain.handle('set-lang', (_event, lang: 'fr' | 'en') => {
|
||||
store.set('userLang', lang);
|
||||
return true;
|
||||
});
|
||||
|
||||
ipcMain.on('login-success', (_event, token: string, userId: string) => {
|
||||
store.set('authToken', token);
|
||||
store.set('userId', userId);
|
||||
|
||||
if (loginWindow) {
|
||||
loginWindow.close();
|
||||
@@ -141,6 +152,8 @@ ipcMain.on('login-success', (_event, token: string) => {
|
||||
|
||||
ipcMain.on('logout', () => {
|
||||
store.delete('authToken');
|
||||
store.delete('userId');
|
||||
store.delete('userLang');
|
||||
|
||||
// Close database connection
|
||||
const db = getDatabaseService();
|
||||
|
||||
Reference in New Issue
Block a user