-
Notifications
You must be signed in to change notification settings - Fork 653
Open
Description
Hi, i'm having a issue for days and can't figure out a solution here is the deal...
i write an interceptor for any response error
export default function authenticationInterceptor($q, $rootScope) {
notAuthenticated: 'auth-not-authenticated'
return {
responseError: (response) => {
$rootScope.$broadcast({
401: notAuthenticated
}[response.status], response);
return $q.reject(response);
}
}
}
and broadcast the event auth-not-authenticated
i'm setting up the interceptor on app.config.js
and trying to check on app.controller that way
export default class AppController {
constructor($scope, $rootScope, $state, authentication) {
notAuthenticated: 'auth-not-authenticated'
$scope.$on(notAuthenticated, (event) => {
authentication.logout();
$state.go('login')
})
but i can't make this work... any help?
what is the best way to handling authentication and events?
Thanks in advance.
Metadata
Metadata
Assignees
Labels
No labels