0

I have problem, I need to change params in the same request, comments are in the bottom of the code

const myMiddleware: Middleware = (store) => (next) => (action) => {
    if (typeof action === 'function') {
        action(store.dispatch, store.getState)
            .unwrap()
            .then((response: any) => {
                if (
                    response?.pagination?.activePage >
                    response?.pagination?.totalPages
                ) {
                    // How can I make the same request, but with another param,
                    // I want to change param activePage from 7 to 1
                    // How can I change it?
                    //store.dispatch(action) // default - {activePage: 7, displayLength: 10}
                    //store.dispatch(action) // need - {activePage: 1, displayLength: 10}
                }
            })
    } else {
        return next(action)
    }
}

0 Answers0