Commit 22d355cb authored by ncastejon's avatar ncastejon
Browse files

Merge branch 'development' of...

Merge branch 'development' of https://gitlab.alpha.grandlyon.com/refonte-data/portail-data into development
parents cfca27dd 112c28a3
......@@ -7,6 +7,7 @@ import { forkJoin } from 'rxjs';
import { notificationMessages } from '../../../../../i18n/traductions';
import { ElasticsearchService } from '../../../../geosource/services';
import { AppRoutes } from '../../../../routes';
import { Router } from '@angular/router';
@Component({
selector: 'app-available-data',
......@@ -28,6 +29,7 @@ export class AvailableDataComponent implements OnInit {
private _userAccessService: UserServicesService,
private _notificationService: NotificationService,
private _elasticSearchService: ElasticsearchService,
private _router: Router,
) { }
ngOnInit() {
......@@ -64,6 +66,7 @@ export class AvailableDataComponent implements OnInit {
type: 'error',
message: `${notificationMessages.userServices.initializationError}`,
}));
this.handle401(err);
},
);
}
......@@ -180,6 +183,7 @@ export class AvailableDataComponent implements OnInit {
type: 'error',
message: `${notificationMessages.userServices.failedToLoadUserResources}`,
}));
this.handle401(err);
},
() => {
this._pendingRequests -= 1;
......@@ -192,6 +196,7 @@ export class AvailableDataComponent implements OnInit {
type: 'error',
message: `${notificationMessages.userServices.addFailed}`,
}));
this.handle401(err);
},
);
}
......@@ -287,4 +292,12 @@ export class AvailableDataComponent implements OnInit {
return this._pendingRequests > 0 ? true : false;
}
// If the error received is an authentication error then redirect to the login page
// because only authenticated users are supposed to access this component
handle401(err) {
if (err && err.status === 401) {
this._router.navigate(['/', AppRoutes.signin.uri]);
}
}
}
......@@ -7,6 +7,7 @@ import { notificationMessages, userServicesStatuses } from '../../../../../i18n/
import { UserServicesService } from '../../../services/user-services.service';
import { ElasticsearchService } from '../../../../geosource/services';
import { AppRoutes } from '../../../../routes';
import { Router } from '@angular/router';
@Component({
selector: 'app-user-services',
......@@ -31,6 +32,7 @@ export class UserServicesComponent implements OnInit {
private _userAccessService: UserServicesService,
private _notificationService: NotificationService,
private _elasticSearchService: ElasticsearchService,
private _router: Router,
) { }
ngOnInit() {
......@@ -59,6 +61,7 @@ export class UserServicesComponent implements OnInit {
type: 'error',
message: `${notificationMessages.userServices.initializationError}`,
}));
this.handle401(err);
},
() => {
this._pendingRequests -= 1;
......@@ -255,6 +258,7 @@ export class UserServicesComponent implements OnInit {
type: 'error',
message: `${notificationMessages.userServices.failedToLoadUserResources}`,
}));
this.handle401(err);
},
() => {
this._pendingRequests -= 1;
......@@ -268,6 +272,7 @@ export class UserServicesComponent implements OnInit {
type: 'error',
message: `${notificationMessages.userServices.removeFailed}`,
}));
this.handle401(err);
},
);
}
......@@ -309,6 +314,7 @@ export class UserServicesComponent implements OnInit {
type: 'error',
message: `${notificationMessages.userServices.renewFailed}`,
}));
this.handle401(err);
},
() => {
this._pendingRequests -= 1;
......@@ -316,4 +322,12 @@ export class UserServicesComponent implements OnInit {
},
);
}
// If the error received is an authentication error then redirect to the login page
// because only authenticated users are supposed to access this component
handle401(err) {
if (err && err.status === 401) {
this._router.navigate(['/', AppRoutes.signin.uri]);
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment