Skip to content

Commit 11e17b8

Browse files
committed
Merge branch 'feature/coreservice' into develop
2 parents 33b98fc + 4ed5c80 commit 11e17b8

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

client/app/modules/core/services/core.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
var app = angular.module('com.module.core');
33

4-
app.service('CoreService', ['$http', 'SweetAlert', 'toasty', function ($http, SweetAlert, toasty) {
4+
app.service('CoreService', ['SweetAlert', 'toasty', function (SweetAlert, toasty) {
55

66
this.alert = function (title, text) {
77
SweetAlert.swal(title, text);

client/app/modules/users/config/users.auth.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ angular.module('com.module.users')
33
.config(function ($routeProvider, $httpProvider) {
44

55
// Intercept 401 responses and redirect to login screen
6-
$httpProvider.interceptors.push(function ($q, $location, CoreService, AppAuth, gettextCatalog) {
6+
$httpProvider.interceptors.push(function ($q, $location, CoreService, AppAuth) {
77
return {
88
responseError: function (rejection) {
99

@@ -18,20 +18,20 @@ angular.module('com.module.users')
1818
if ($location.path() !== '/register') {
1919
$location.path('/login');
2020
}
21-
CoreService.toastWarning(gettextCatalog.getString('Error 401 received'), gettextCatalog.getString('We received a 401 error from the API! Redirecting to login'));
21+
CoreService.toastWarning('Error 401 received', 'We received a 401 error from the API! Redirecting to login');
2222
}
2323
}
2424
if (rejection.status === 404) {
2525
console.log(rejection);
26-
CoreService.toastError(gettextCatalog.getString('Error 404 received'), rejection.data.error.message);
26+
CoreService.toastError('Error 404 received', rejection.data.error.message);
2727
}
2828
if (rejection.status === 422) {
2929
console.log(rejection);
30-
CoreService.toastError(gettextCatalog.getString('Error 422 received'), rejection.data.error.message);
30+
CoreService.toastError('Error 422 received', rejection.data.error.message);
3131
}
3232
if (rejection.status === 0) {
3333
$location.path('/');
34-
CoreService.toastError(gettextCatalog.getString('Connection Refused'), gettextCatalog.getString('The connection to the API is refused. Please verify that the API is running!'));
34+
CoreService.toastError('Connection Refused', 'The connection to the API is refused. Please verify that the API is running!');
3535
}
3636
return $q.reject(rejection);
3737
}

client/app/modules/users/controllers/users.ctrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ app.controller('UsersCtrl', function ($scope, $stateParams, $state, CoreService,
4949
CoreService.toastSuccess(gettextCatalog.getString('User saved'), gettextCatalog.getString('This user is save!'));
5050
$state.go('^.list');
5151
}, function (err) {
52-
CoreService.toastError(gettextCatalog.getString('Error saving user'));
52+
CoreService.toastError(gettextCatalog.getString('Error saving user: ', + err));
5353
});
5454
};
5555

0 commit comments

Comments
 (0)