function sessionAuth(transition) {
    const injector = transition.injector();
    const utils = injector.get('Utils');
    const session = injector.get('Session');
    const $window = injector.get('$window');
    const $state = injector.get('$state');
    const target = transition.targetState();
    const states = target.$state().includes;

    if (states && !states.hasOwnProperty('auth') && !utils.isAuthed()) {
        session.set('prevState', {
            state: target.name(),
            params: target.params()
        });
    }

    if (!(states.hasOwnProperty('auth') && states.auth)) {
        let data = JSON.parse($window.localStorage.getItem('cloud-inquisitor'));
        if (utils.isAuthed() && data && data.hasOwnProperty('auth') && data.hasOwnProperty('csrf')) {
            return true;
        }

        return $state.target('auth.redirect');
    }
    return true;
}
/**
 * Ensures the session is sending authentication and CSRF headers when applicable
 * @param {object} transition
 * @returns {$promise|boolean}
 */
Ensures the session is sending authentication and CSRF headers when applicable
@param {object} transition
@returns {$promise|boolean}
Ensures the session is sending authentication and CSRF headers when applicable @param { object } transition @returns { $promise|boolean }
function sessionAuth(transition) {
    const injector = transition.injector();
    const utils = injector.get('Utils');
    const session = injector.get('Session');
    const $window = injector.get('$window');
    const $state = injector.get('$state');
    const target = transition.targetState();
    const states = target.$state().includes;
    if (states && !states.hasOwnProperty('auth') && !utils.isAuthed()) {
        session.set('prevState', {
            state: target.name(),
            params: target.params()
        });
    }
    if (!(states.hasOwnProperty('auth') && states.auth)) {
        let data = JSON.parse($window.localStorage.getItem('cloud-inquisitor'));
        if (utils.isAuthed() && data && data.hasOwnProperty('auth') && data.hasOwnProperty('csrf')) {
            return true;
        }
        return $state.target('auth.redirect');
    }
    return true;
}
function sessionAuth ( transition ) { const injector = transition . injector ( ) ; const utils = injector . get ( 'Utils' ) ; const session = injector . get ( 'Session' ) ; const $window = injector . get ( '$window' ) ; const $state = injector . get ( '$state' ) ; const target = transition . targetState ( ) ; const states = target . $state ( ) . includes ; if ( states && ! states . hasOwnProperty ( 'auth' ) && ! utils . isAuthed ( ) ) { session . set ( 'prevState' , { state : target . name ( ) , params : target . params ( ) } ) ; } if ( ! ( states . hasOwnProperty ( 'auth' ) && states . auth ) ) { let data = JSON . parse ( $window . localStorage . getItem ( 'cloud-inquisitor' ) ) ; if ( utils . isAuthed ( ) && data && data . hasOwnProperty ( 'auth' ) && data . hasOwnProperty ( 'csrf' ) ) { return true ; } return $state . target ( 'auth.redirect' ) ; } return true ; }
Ensures the session is sending authentication and CSRF headers when applicable
 @param {object} transition
 @returns {$promise|boolean}
Ensures the session is sending authentication and CSRF headers when applicable @param { object } transition @returns { $promise|boolean }