From 145bd6f70138246b4e5efebcd94786f147ac9e7a Mon Sep 17 00:00:00 2001 From: Matthias Einwag Date: Wed, 23 Sep 2020 01:03:34 -0700 Subject: Fix clearing the token The previous version would have interpreted an empty token as an abort of the dialog and would have not properly cleared the token. This is now fixed by checking for `undefined` for a an abort and by setting the token to `undefined` in order to clear it. --- editors/code/src/main.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'editors') diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 2fcd853d4..ce7c56d05 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -393,8 +393,13 @@ async function queryForGithubToken(state: PersistentState): Promise { }; const newToken = await vscode.window.showInputBox(githubTokenOptions); - if (newToken) { - log.info("Storing new github token"); - await state.updateGithubToken(newToken); + if (newToken !== undefined) { + if (newToken === "") { + log.info("Clearing github token"); + await state.updateGithubToken(undefined); + } else { + log.info("Storing new github token"); + await state.updateGithubToken(newToken); + } } } -- cgit v1.2.3