resources/assets/js/authenticator.js
// Redirect User if response is for an invalid/expired token.
Redirect User if response is for an invalid/expired token.
Redirect User if response is for an invalid / expired token .
_checkAuthentication(request, response) {
        return new Promise((resolve, reject) => {
            if (response.status === 401 && this._authTokenErrors.indexOf(response.json().error) !== -1) {
                if (! this._refreshing) this._refreshAuthToken();
                return this._remakeRequest(request).then((newRes) => {
                    resolve(newRes);
                });
            }
            resolve(response);
        });
    }
_checkAuthentication ( request , response ) { return new Promise ( ( resolve , reject ) => { if ( response . status === 401 && this . _authTokenErrors . indexOf ( response . json ( ) . error ) !== - 1 ) { if ( ! this . _refreshing ) this . _refreshAuthToken ( ) ; return this . _remakeRequest ( request ) . then ( ( newRes ) => { resolve ( newRes ) ; } ) ; } resolve ( response ) ; } ) ; }
Redirect User if response is for an invalid/expired token.
Redirect User if response is for an invalid / expired token .
// response hit a token/auth related error // If we're not refreshing our token yet, get on it. // Return a promise that the request will be remade. // Remade and finished checking authentication. // if we didn't get any token errors, just pass our response back