Skip to content

Commit

Permalink
Fixed the errors, redirection 401, 403 processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruslan Baidan committed Apr 23, 2021
1 parent bc128de commit e351173
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/BackofficeApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,15 @@ angular
var ErrorService = $injector.get('ErrorService');

if (response.status == 401) {
var $state = $injector.get('$state');
$state.transitionTo('login');
const state = $injector.get('$state');
state.transitionTo('login');
} else if (response.status == 403) {
const resourceUrl = response.config.url;
if (resourceUrl) {
ErrorService.notifyError('This resource is forbidden: ' + resourceUrl);
} else {
ErrorService.notifyError('Unauthorized operation occurred.');
}
} else if (response.status == 412) {
// Human-readable error, with translation support
for (var i = 0; i < response.data.errors.length; ++i) {
Expand Down

0 comments on commit e351173

Please sign in to comment.