Skip to content

Commit 3982706

Browse files
authored
log a confirmation message after a successful logout (#1131)
* log a confirmation message after a successful logout * fix test
1 parent be7fe26 commit 3982706

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/observableApiAuth.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ export async function loginInner(
118118
}
119119

120120
export async function logout(effects = defaultEffects) {
121+
const {logger} = effects;
121122
await effects.setObservableApiKey(null);
123+
logger.log(`You are now logged out of ${OBSERVABLE_UI_ORIGIN.hostname}.`);
122124
}
123125

124126
export async function whoami(effects = defaultEffects) {

test/observableApiAuth-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe("logout command", () => {
7272
await logout(effects);
7373
assert.equal(effects.observableApiKey, null);
7474
assert.equal(await effects.setApiKeyDeferred.promise, undefined);
75-
effects.logger.assertExactLogs([]);
75+
effects.logger.assertExactLogs([/^You are now logged out of/]);
7676
});
7777
});
7878

0 commit comments

Comments
 (0)