Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
fix(token-dialog): raise error if no account
Browse files Browse the repository at this point in the history
If there is not any account, it may be due to a token generated before
the creation of a V20 account (you can fix it recreating the token) or
there are not V20 account, because there are only the legacy ones (you
can fix it creating a new V20 account).
  • Loading branch information
albertosantini committed Mar 16, 2017
1 parent 4665ac0 commit 6595574
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion build/app.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1883,9 +1883,18 @@ class TokenDialogController {
environment: this.environment,
token: this.token
}).then(accounts => {
const message = "If your account id contains only digits " +
"(ie. 2534233), it is a legacy account and you should use " +
"release 3.x. For v20 accounts use release 4.x or higher. " +
"Check your token.";

if (!accounts.length) {
throw new Error(message);
}
angular.extend(this.accounts, accounts);
}, err => {
}).catch(err => {
this.ToastsService.addToast(err);
this.closeModal();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,18 @@ export class TokenDialogController {
environment: this.environment,
token: this.token
}).then(accounts => {
const message = "If your account id contains only digits " +
"(ie. 2534233), it is a legacy account and you should use " +
"release 3.x. For v20 accounts use release 4.x or higher. " +
"Check your token.";

if (!accounts.length) {
throw new Error(message);
}
angular.extend(this.accounts, accounts);
}, err => {
}).catch(err => {
this.ToastsService.addToast(err);
this.closeModal();
});
}

Expand Down

0 comments on commit 6595574

Please sign in to comment.