Fix error when connection fail
This commit is contained in:
parent
1aede751a9
commit
edbae6f730
3 changed files with 32 additions and 9 deletions
|
|
@ -28,16 +28,27 @@
|
|||
<img src="img/glidera-logo.png" ng-click="index.updateGlidera(index.glideraToken, index.glideraPermissions)">
|
||||
</div>
|
||||
|
||||
<div class="m20b box-notification" ng-if="index.glideraError || glidera.error">
|
||||
<div class="m20b box-notification" ng-if="index.glideraError">
|
||||
<div class="text-warning">
|
||||
<span ng-show="index.glideraError == 'Unauthorized'" translate>Could not connect to Glidera: Unauthorized</span>
|
||||
<span ng-show="index.glideraError == 'Forbidden'" translate>Could not connect to Glidera: Forbidden</span>
|
||||
<span ng-show="index.glideraError != ('Forbidden' && 'Unauthorized')">{{index.glideraError || glidera.error}}</span>
|
||||
<span>{{index.glideraError}}</span>
|
||||
</div>
|
||||
<div class="m10t" ng-show="index.glideraToken && index.glideraError == 'Forbidden'">
|
||||
<button class="round tiny" ng-click="index.glideraToken = null; index.glideraError = null">
|
||||
Request a new token
|
||||
</div>
|
||||
<div class="m10t text-center" ng-show="index.glideraError">
|
||||
<button
|
||||
class="dark-gray outline round tiny"
|
||||
ng-show="index.glideraError.indexOf('Forbidden') == 40"
|
||||
ng-click="index.glideraToken = null; index.glideraError = null">
|
||||
Request a new token
|
||||
</button>
|
||||
<div ng-show="index.glideraError.indexOf('Forbidden') != 40">
|
||||
<button
|
||||
class="dark-gray outline round tiny"
|
||||
ng-click="index.initGlidera(index.glideraToken)">
|
||||
Retry
|
||||
</button>
|
||||
<div class="m20t size-12">
|
||||
<a class="text-gray" ng-click="$root.go('preferencesGlidera')" translate>Preferences</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -67,6 +78,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="text-center" ng-show="showOauthForm">
|
||||
<div class="text-left box-notification size-12 text-warning" ng-show="glidera.error">
|
||||
{{glidera.error}}
|
||||
</div>
|
||||
<form name="oauthCodeForm" ng-submit="glidera.submitOauthCode(code)" novalidate>
|
||||
<label>OAuth Code</label>
|
||||
<input type="text" ng-model="code" ng-disabled="glidera.loading"
|
||||
|
|
|
|||
|
|
@ -252,8 +252,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<ul ng-if="index.glideraToken"
|
||||
class="no-bullet m0 size-14">
|
||||
<ul class="no-bullet m0 size-14">
|
||||
<h4 class="title m0" translate>Account</h4>
|
||||
|
||||
<li class="line-b p20" ng-click="glidera.revokeToken()">
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
var fc = profileService.focusedClient;
|
||||
var self = this;
|
||||
this.loading = true;
|
||||
this.error = null;
|
||||
$timeout(function() {
|
||||
glideraService.getToken(code, function(err, data) {
|
||||
self.loading = null;
|
||||
|
|
@ -72,4 +73,13 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
});
|
||||
};
|
||||
|
||||
this.revokeToken = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
storageService.removeGlideraToken(fc.credentials.network, function() {
|
||||
$timeout(function() {
|
||||
applicationService.restart();
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue