Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Check if we already have a user when calling set-user
Browse files Browse the repository at this point in the history
  • Loading branch information
jwheare committed May 6, 2020
1 parent 13ba0d9 commit 6b3a4b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/render/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var remote = require('electron').remote;
function setupUserListener() {
document.addEventListener("DOMContentLoaded", function (event) {
remote.getCurrentWindow().webContents.executeJavaScript(
'new Promise((resolve, reject) => { if (SESSION) { SESSION.once("init", function () { resolve({ id: this.id, name: this.get("name"), email: this.get("email") }); }); SESSION.once("noAuth", function () { resolve(null); }); } else { resolve(null); } });'
'new Promise((resolve, reject) => { if (SESSION) { if (SESSION.id) { resolve({ id: SESSION.id, name: SESSION.get("name"), email: SESSION.get("email") }); } else { SESSION.once("init", function () { resolve({ id: SESSION.id, name: SESSION.get("name"), email: SESSION.get("email") }); }); } SESSION.once("noAuth", function () { resolve(null); }); } else { resolve(null); } });'
).then((result) => {
ipcRenderer.send('set-user', result);
});
Expand Down

0 comments on commit 6b3a4b2

Please sign in to comment.