thecodingmachine / redux-toolkit-wrapper

Redux-toolkit wrapper used to write less code regarding classic CRUD operations.
MIT License
19 stars 5 forks source link

How to handle form submit and redirect flow? #9

Open tcagkansokmen opened 3 years ago

tcagkansokmen commented 3 years ago

Normally we use "success" and return it true, and turn it to false after redirect.

But in that case we can use only "loading" and "error" variables.

How can we handle form submit-redirect flow?

JeremyDolle commented 3 years ago

Hi @tcagkansokmen, it's because we don't need it. In the handle submit function, you have to dispatch your action and use unwrapResult in a then callback for the success part, and use a catch callback for the error part. See: here.