Skip to content

Commit 241bc0f

Browse files
committed
updated approved sites to use error handler
1 parent 055b5cc commit 241bc0f

File tree

1 file changed

+7
-22
lines changed
  • openid-connect-server-webapp/src/main/webapp/resources/js

1 file changed

+7
-22
lines changed

openid-connect-server-webapp/src/main/webapp/resources/js/grant.js

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ var ApprovedSiteListView = Backbone.View.extend({
5353
'<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> '
5454
);
5555

56-
$.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-grants').addClass('label-success');}}),
57-
this.options.clientList.fetchIfNeeded({success:function(e) {$('#loading-clients').addClass('label-success');}}),
58-
this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
56+
$.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-grants').addClass('label-success');}, error:app.errorHandlerView.handleError()}),
57+
this.options.clientList.fetchIfNeeded({success:function(e) {$('#loading-clients').addClass('label-success');}, error:app.errorHandlerView.handleError()}),
58+
this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
5959
.done(function() {
6060
$('#loadingbox').sheet('hide');
6161
callback();
@@ -115,9 +115,9 @@ var ApprovedSiteListView = Backbone.View.extend({
115115
'<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> '
116116
);
117117

118-
$.when(this.model.fetch({success:function(e) {$('#loading-grants').addClass('label-success');}}),
119-
this.options.clientList.fetch({success:function(e) {$('#loading-clients').addClass('label-success');}}),
120-
this.options.systemScopeList.fetch({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
118+
$.when(this.model.fetch({success:function(e) {$('#loading-grants').addClass('label-success');}, error:app.errorHandlerView.handleError()}),
119+
this.options.clientList.fetch({success:function(e) {$('#loading-clients').addClass('label-success');}, error:app.errorHandlerView.handleError()}),
120+
this.options.systemScopeList.fetch({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
121121
.done(function() {
122122
$('#loadingbox').sheet('hide');
123123
_self.render();
@@ -227,22 +227,7 @@ var ApprovedSiteView = Backbone.View.extend({
227227
});
228228
});
229229
},
230-
error:function (error, response) {
231-
232-
//Pull out the response text.
233-
var responseJson = JSON.parse(response.responseText);
234-
235-
//Display an alert with an error message
236-
$('#modalAlert div.modal-header').html(responseJson.error);
237-
$('#modalAlert div.modal-body').html(responseJson.error_description);
238-
239-
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
240-
"backdrop" : "static",
241-
"keyboard" : true,
242-
"show" : true // ensure the modal is shown immediately
243-
});
244-
}
245-
230+
error:app.errorHandlerView.handleError()
246231
});
247232

248233
this.parentView.delegateEvents();

0 commit comments

Comments
 (0)