File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,19 @@ export class AccountStore {
68
68
}
69
69
}
70
70
71
+ public async pruneAccounts ( ) : Promise < void > {
72
+ let configValues = this . getAccounts ( ) ;
73
+ configValues = configValues . filter ( ( val ) => {
74
+ if ( val . key ) {
75
+ return true ;
76
+ } else {
77
+ return false ;
78
+ }
79
+ } ) ;
80
+ await this . _context . globalState . update ( Constants . configAzureAccount , configValues ) ;
81
+ return ;
82
+ }
83
+
71
84
public async clearAccounts ( ) : Promise < void > {
72
85
let configValues = [ ] ;
73
86
await this . _context . globalState . update ( Constants . configAzureAccount , configValues ) ;
Original file line number Diff line number Diff line change @@ -1156,9 +1156,14 @@ export default class ConnectionManager {
1156
1156
return prompter . prompt < IAccount > ( questions , true ) . then ( async answers => {
1157
1157
if ( answers ?. account ) {
1158
1158
try {
1159
- this . _accountStore . removeAccount ( answers . account . key . id ) ;
1159
+ if ( answers . account . key ) {
1160
+ this . _accountStore . removeAccount ( answers . account . key . id ) ;
1161
+ } else {
1162
+ await this . _accountStore . pruneAccounts ( ) ;
1163
+ }
1160
1164
this . azureController . removeAccount ( answers . account ) ;
1161
1165
this . vscodeWrapper . showInformationMessage ( LocalizedConstants . accountRemovedSuccessfully ) ;
1166
+
1162
1167
} catch ( e ) {
1163
1168
this . vscodeWrapper . showErrorMessage ( Utils . formatString ( LocalizedConstants . accountRemovalFailed , e . message ) ) ;
1164
1169
}
You can’t perform that action at this time.
0 commit comments