Skip to content

Commit

Permalink
Don't ask for creds on logout
Browse files Browse the repository at this point in the history
  • Loading branch information
harveysanders committed Jan 30, 2024
1 parent a32983f commit 51195fa
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions controller/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ function writeUser(auth) {
const { id, message } = JSON.parse(stdout);
if (err) {
rej(err);
return;
} else if (message) {
rej(message);
return;
}
ensureApplicationDirectory();
fsJson.saveSync(userFilePath, {
Expand Down Expand Up @@ -289,17 +291,14 @@ function grabLocalAuthToken() {

module.exports.grabLocalAuthToken = grabLocalAuthToken;

function deauthorizeUser() {
return new Promise(function (res, rej) {
promptForUserInfo()
// .then(deleteAuth)
.then(deleteUserInfo)
.then(() => {
console.log(clc.blue('Successfully logged out!'));
res(true);
})
.catch(err => rej(clc.red(`${err}`)));
});
async function deauthorizeUser() {
try {
deleteUserInfo();
console.log(clc.blue('Successfully logged out!'));
return true;
} catch (error) {
return Promise.reject(clc.red(`${error}`));
}
}

module.exports.deauthorizeUser = deauthorizeUser;
Expand Down

0 comments on commit 51195fa

Please sign in to comment.