Skip to content
This repository was archived by the owner on May 20, 2022. It is now read-only.

Commit 15581f4

Browse files
committed
refactor(example): fix minor issues in b2cClient.ts
1 parent d36d2e8 commit 15581f4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

example/src/b2cClient.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default class B2CClient {
5353
return await this.pca.acquireToken({ ...params });
5454
} catch (error) {
5555
if (error.message.includes(B2CClient.B2C_PASSWORD_CHANGE) && this.policies.passwordReset) {
56-
return this.resetPassword(params);
56+
return await this.resetPassword(params);
5757
} else {
5858
throw error;
5959
}
@@ -80,11 +80,9 @@ export default class B2CClient {
8080

8181
/** Removes all accounts from the device for this app. User will have to sign in again to get a token */
8282
public async signOut(params?: B2CSignOutParams) {
83-
let accounts = await this.pca.getAccounts();
84-
while (accounts.length > 0) {
85-
await this.pca.signOut({ ...params, account: accounts[0] });
86-
accounts = await this.pca.getAccounts();
87-
}
83+
const accounts = await this.pca.getAccounts();
84+
const signOutPromises = accounts.map((account) => this.pca.signOut({ ...params, account }));
85+
await Promise.all(signOutPromises);
8886
return true;
8987
}
9088

0 commit comments

Comments
 (0)