I have a redux action that returns a promise, so that the ui can respond accordingly based upon the result. This action sends a request to the backend, and when it gets a successful response from the server, it resolves.
redux action:
export const preauthorizePayment = (amount, connectedAccountId, customerId) => {
    console.log("action reached")
    return (dispatch) => {
        dispatch({ type: types.UPDATING })
        return new Promise((reject, resolve) => {
            console.log("promise reached")
            axios.get(PRE_AUTH_ENDPOINT, {
                params: {
                    amount: amount,
                    customerId: customerId,
                    connectedAccountId: connectedAccountId
                }
            })
                .then(res => {
                    console.log("then reached...")
                    if (res.data.result == 'success') {
                        dispatch({ type: types.UPDATE_SUCCESS });
                        console.log("if reached...");
                        return resolve();
                    } else {
                        console.log("else reached...")
                        console.log(JSON.stringify(res))
                        dispatch({
                            type: types.UPDATE_FAIL,
                            info: res.data.errorInfo,
                            errorCode: res.data.errorCode
                        })
                        return reject()
                    }
                })
                .catch(err => {
                    dispatch({ type: types.UPDATE_FAIL, errorInfo: err })
                    return reject()
                })
        })
    }
}
the UI piece looks like:
props.preauthorizePayment(amount, connectedAccountId, customerId)
  .then(() => {
    console.log("pre-auth then reached")
    // pre-auth success
    setCheckInModal(false)
    props.checkIn(props.evnt.id, props.role)
  })
  .catch(err => setCheckInModal(true))
What im experiencing is that everything is working properly up until the resolve() portion of the redux action. din the if block of the redux action's then(), the dispatch gets fired, the log fires, but it doesn't resolve. The UI piece's then() does not execute, no log, nothing. initially I didnt have the return keyword in the resolve line, and once I added it, it worked once. but then it stopped.
Whats going on?
