Skip to content

Commit

Permalink
Fixed API Key reset and delete cancel and a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomgcd committed Jul 23, 2021
1 parent 2345c86 commit a4748ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 0 additions & 3 deletions v2/api/builder/apifield.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#apibuilder .bar:before, #apibuilder .bar:after {
background:white;
}
#apifield{
margin-bottom:45px;
}
8 changes: 6 additions & 2 deletions v2/api/sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ export class SendResults extends Array {
this.merge(results)
}
merge(other){
for(var result of other){
this.push(new SendResult(result.messageId,result.success,result.message));
try{
for(var result of other){
this.push(new SendResult(result.messageId,result.success,result.message));
}
}catch{
//do nothing if other is not iterable
}
this.success = this.count(result=>result.success);
this.failure = this.count(result=>!result.success);
Expand Down
7 changes: 5 additions & 2 deletions v2/device/apphelperdevices.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ export class AppHelperDevices extends AppHelperBase{
}
async onRequestResetApiKey(){
try{
if(!this.confirmApiKeyDelete()) return;
const shouldReset = await this.confirmApiKeyDelete();
if(!shouldReset) return;

this._apiKey = await ApiServer.resetApiKey();
app.showToast({text:`API Key reset!`});
Expand All @@ -234,7 +235,9 @@ export class AppHelperDevices extends AppHelperBase{
}
async onRequestDeleteApiKey(){
try{
if(!this.confirmApiKeyDelete()) return;
const shouldReset = await this.confirmApiKeyDelete();
if(!shouldReset) return;

await ApiServer.deleteApiKey();
this._apiKey = null;
await this.apiBuilder.generateUrl(null);
Expand Down

0 comments on commit a4748ff

Please # to comment.