RTK Query redirect status 303

20 Views Asked by At

I'm making a POST request to the server with RTK Query. I received a 303 status in response with the Location header, to which I need to redirect. If I understand correctly, the redirect should be performed automatically, but it does not happen.

    endpointName: builder.mutation<any, { id: string }>({
       query: ({ id }) => ({
         url: `${ApiRoutes.APPLICATION}/${id}${ApiRoutes.PAY}`,
         method: 'POST',
         redirect: 'follow',
         responseHandler: (response) => {
            console.log(response); //status=200, redirected=true
         },
       })
     }),

If you look at the responseHandler logs, there is status 200 redirected But in dev tools i received a 303 status in response with the Location header, to which I need to redirect.

What's my mistake? Thank you!

0

There are 0 best solutions below