fix the account not found error when creating firewall rules (#2543)

This commit is contained in:
Alan Ren
2018-09-12 13:32:40 -07:00
committed by GitHub
parent 801e201cc3
commit d85bf4f6dd

View File

@@ -90,14 +90,16 @@ export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
}
public $getSecurityToken(account: sqlops.Account): Thenable<{}> {
for (const handle in this._accounts) {
const providerHandle = parseInt(handle);
if (this._accounts[handle].findIndex((acct) => acct.key.accountId === account.key.accountId) !== -1) {
return this._withProvider(providerHandle, (provider: sqlops.AccountProvider) => provider.getSecurityToken(account));
return this.$getAllAccounts().then(() => {
for (const handle in this._accounts) {
const providerHandle = parseInt(handle);
if (this._accounts[handle].findIndex((acct) => acct.key.accountId === account.key.accountId) !== -1) {
return this._withProvider(providerHandle, (provider: sqlops.AccountProvider) => provider.getSecurityToken(account));
}
}
}
throw new Error(`Account ${account.key.accountId} not found.`);
throw new Error(`Account ${account.key.accountId} not found.`);
});
}
public get onDidChangeAccounts(): Event<sqlops.DidChangeAccountsParams> {