Skip to content

Commit 1366db3

Browse files
committed
updated scopes to use error handler
1 parent 838fcb6 commit 1366db3

File tree

1 file changed

+5
-33
lines changed
  • openid-connect-server-webapp/src/main/webapp/resources/js

1 file changed

+5
-33
lines changed

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

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,7 @@ var SystemScopeView = Backbone.View.extend({
123123
});
124124
});
125125
},
126-
error:function (error, response) {
127-
128-
//Pull out the response text.
129-
var responseJson = JSON.parse(response.responseText);
130-
131-
//Display an alert with an error message
132-
$('#modalAlert div.modal-header').html(responseJson.error);
133-
$('#modalAlert div.modal-body').html(responseJson.error_description);
134-
135-
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
136-
"backdrop" : "static",
137-
"keyboard" : true,
138-
"show" : true // ensure the modal is shown immediately
139-
});
140-
}
126+
error:app.errorHandlerView.handleError()
141127
});
142128

143129
_self.parentView.delegateEvents();
@@ -170,7 +156,7 @@ var SystemScopeListView = Backbone.View.extend({
170156
'<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> '
171157
);
172158

173-
$.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
159+
$.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
174160
.done(function() {
175161
$('#loadingbox').sheet('hide');
176162
callback();
@@ -194,7 +180,7 @@ var SystemScopeListView = Backbone.View.extend({
194180
'<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> '
195181
);
196182

197-
$.when(this.model.fetch({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
183+
$.when(this.model.fetch({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
198184
.done(function() {
199185
$('#loadingbox').sheet('hide');
200186
_self.render();
@@ -296,7 +282,7 @@ var SystemScopeFormView = Backbone.View.extend({
296282
'<span class="label" id="loading-scopes">' + $.t("common.scopes") + '</span> '
297283
);
298284

299-
$.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
285+
$.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
300286
.done(function() {
301287
$('#loadingbox').sheet('hide');
302288
callback();
@@ -340,21 +326,7 @@ var SystemScopeFormView = Backbone.View.extend({
340326
app.systemScopeList.add(_self.model);
341327
app.navigate('admin/scope', {trigger: true});
342328
},
343-
error:function(error, response) {
344-
345-
//Pull out the response text.
346-
var responseJson = JSON.parse(response.responseText);
347-
348-
//Display an alert with an error message
349-
$('#modalAlert div.modal-header').html(responseJson.error);
350-
$('#modalAlert div.modal-body').html(responseJson.error_description);
351-
352-
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
353-
"backdrop" : "static",
354-
"keyboard" : true,
355-
"show" : true // ensure the modal is shown immediately
356-
});
357-
}
329+
error:app.errorHandlerView.handleError()
358330
});
359331
}
360332

0 commit comments

Comments
 (0)