This commit is contained in:
Christopher Suh
2023-03-22 12:57:49 -07:00
committed by GitHub
parent ed37ad315f
commit 14ea5e9dd7

View File

@@ -321,18 +321,19 @@ export class AccountManagementService implements IAccountManagementService {
// Step 3) Update the account cache and fire an event
return this.doWithProvider(accountKey.providerId, async provider => {
const result = await this._accountStore.remove(accountKey);
let indexToRemove: number = provider.accounts.findIndex(account => {
return account.key.accountId === accountKey.accountId;
});
await provider.provider.clear(accountKey);
if (!result) {
return result;
}
let indexToRemove: number = provider.accounts.findIndex(account => {
return account.key.accountId === accountKey.accountId;
});
if (indexToRemove >= 0) {
provider.accounts.splice(indexToRemove, 1);
this.fireAccountListUpdate(provider, false);
} else {
this._logService.error(`Error when removing an account: ${accountKey.accountId} could not find account in provider list.`);
}
return result;
});