We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
The text was updated successfully, but these errors were encountered:
why are you declaring variables with the colon? 😕
Sorry, something went wrong.
oh, sry, that was a constant and i copy paste just to try a thing... i'm using as a constant and is returning the right value.
export default function authenticationInterceptor($q, $rootScope, AUTH_EVENTS) { return { responseError: (response) => { $rootScope.$broadcast({ 401: AUTH_EVENTS.notAuthenticated }[response.status], response); return $q.reject(response); } } }
export default class AppController { constructor($scope, $rootScope, $state, authentication, AUTH_EVENTS) { $scope.$on(AUTH_EVENTS.notAuthenticated, (event) => { authentication.logout(); $state.go('login') })
No branches or pull requests
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
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
but i can't make this work... any help?
what is the best way to handling authentication and events?
Thanks in advance.
The text was updated successfully, but these errors were encountered: