C
C
CoolBatman2732020-04-16 17:52:47
typescript
CoolBatman273, 2020-04-16 17:52:47

Using redux-thunk, the returned function goes into the action. How to fix it?

export const changeSearchValue = (value: string): Function => {
    return (dispatch: Function): void => {
        dispatch({
            type: CHANGE,
            payload: value
        });
        Axios.get("https://www.balldontlie.io/api/v1/players", {
            params: {
                per_page: 5,
                search: value
            }
        })
            .then(function (response: any): void {
                dispatch({
                    type: SET_SUGGESTIONS,
                    payload: response.data.data
                })
            })
            .catch(function (error: any): void {
                console.log(error);
            })
    };
};

5e98711b61eb6333169201.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2020-04-16
@CoolBatman273

The logger must be the last in the middleware chain

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question