Open Dialog or Modal if AUTH_ERROR (401)

183 Views Asked by At

I would like to open a Dialog or Modal if I get a status 401 in AUTH_ERROR. What is the best way to implement this.

Thanks!

1

There are 1 best solutions below

0
On

You'll have to take the custom app route:

Follow the documentation to bootstrap your custom app.

Add a saga which should take the latest (takeLatest in redux-saga) FETCH_ERROR action. This action has an error property. The saga should then dispatch (put in redux-saga) a custom action which will be used by a reducer you'll add.

This reducer should contain the data required for the modal: at least a boolean determining whether to show it or not.

Finally, update your custom app by adding it a custom redux connected component which will check if it has to show your modal.