Q: Cannot read property of undefined 'refreshToken' Trying to write a Redux middleware to refresh a token - I'm getting 'Cannot read property refreshToken of undefined on .refreshToken({refreshToken: refreshToken}).
How is this actually possible to error?  
 function checkExpiredToken({ getState, dispatch }) {
        return next => action => {
            let user = getState().auth.user;

            if (user && user.refreshToken && moment(user.expiryDate).isBefore(moment())) {
                let refreshToken = user.refreshToken;

                if (refreshToken) {
                    auth0.auth
                        .refreshToken({ refreshToken: refreshToken })
                        .then(credentials => {
                            // Set the Bearer Authorization header on every axios request
                            axios.defaults.headers.common["Authorization"] = `${credentials.tokenType} ${
                                credentials.idToken
                            }`;

                            dispatch({ type: REFRESHED_TOKEN, payload: credentials });
                            next(action);
                        })
                        .catch(console.error);
                }
            } else {
                next(action);
            }
        };
    }

