Skip to content

Commit

Permalink
temporal commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanVicens committed Apr 3, 2024
1 parent d83a458 commit 1fac75d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/apps/main/auth/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 1fac75d

Please sign in to comment.