diff --git a/src/apps/main/auth/handlers.ts b/src/apps/main/auth/handlers.ts index 9b5adfd5b..c7e6b5d18 100644 --- a/src/apps/main/auth/handlers.ts +++ b/src/apps/main/auth/handlers.ts @@ -58,13 +58,18 @@ export function onUserUnauthorized() { ipcMain.on('user-is-unauthorized', onUserUnauthorized); ipcMain.on('user-logged-in', async (_, data: AccessResponse) => { - setCredentials(data.user, data.user.mnemonic, data.token, data.newToken); - if (!canHisConfigBeRestored(data.user.uuid)) { - await setupRootFolder(); + try { + setCredentials(data.user, data.user.mnemonic, data.token, data.newToken); + if (!canHisConfigBeRestored(data.user.uuid)) { + await setupRootFolder(); + } + + setIsLoggedIn(true); + eventBus.emit('USER_LOGGED_IN'); + } catch (err) { + Logger.info('USER TOKENS:', data.token, data.newToken); + Logger.error(err); } - - setIsLoggedIn(true); - eventBus.emit('USER_LOGGED_IN'); }); ipcMain.on('user-logged-out', () => {