Skip to content

Commit bba0b2f

Browse files
committed
converted blacklist to new error handler
1 parent ed75368 commit bba0b2f

File tree

1 file changed

+3
-32
lines changed
  • openid-connect-server-webapp/src/main/webapp/resources/js

1 file changed

+3
-32
lines changed

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

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var BlackListListView = Backbone.View.extend({
4444
'<span class="label" id="loading-blacklist">' + $.t('admin.blacklist') + '</span> '
4545
);
4646

47-
$.when(this.collection.fetchIfNeeded({success:function(e) {$('#loading-blacklist').addClass('label-success');}}))
47+
$.when(this.collection.fetchIfNeeded({success:function(e) {$('#loading-blacklist').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
4848
.done(function() {
4949
$('#loadingbox').sheet('hide');
5050
callback();
@@ -121,20 +121,7 @@ var BlackListListView = Backbone.View.extend({
121121
_self.collection.add(item);
122122
_self.render();
123123
},
124-
error:function(error, response) {
125-
//Pull out the response text.
126-
var responseJson = JSON.parse(response.responseText);
127-
128-
//Display an alert with an error message
129-
$('#modalAlert div.modal-header').html(responseJson.error);
130-
$('#modalAlert div.modal-body').html(responseJson.error_description);
131-
132-
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
133-
"backdrop" : "static",
134-
"keyboard" : true,
135-
"show" : true // ensure the modal is shown immediately
136-
});
137-
}
124+
error:app.errorHandlerView.handleError()
138125
});
139126

140127
}
@@ -182,23 +169,7 @@ var BlackListWidgetView = Backbone.View.extend({
182169
});
183170
});
184171
},
185-
error:function (model, response) {
186-
//Pull out the response text.
187-
var responseJson = {error: 'Error', error_description: 'Error.'};
188-
if (response) {
189-
responseJson = JSON.parse(response.responseText);
190-
}
191-
192-
//Display an alert with an error message
193-
$('#modalAlert div.modal-header').html(responseJson.error);
194-
$('#modalAlert div.modal-body').html(responseJson.error_description);
195-
196-
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
197-
"backdrop" : "static",
198-
"keyboard" : true,
199-
"show" : true // ensure the modal is shown immediately
200-
});
201-
}
172+
error:app.errorHandlerView.handleError()
202173
});
203174

204175
_self.parentView.delegateEvents();

0 commit comments

Comments
 (0)