When users don’t have permission, the form models keep loading due to an error while retrieving data model. You can see the image below:
Do you have any way to display a notification to users instead of only logging the error in console? It would be great to be able to configure a notification in this case.
We have examples in our sample application: <INTERNAL_LINK>
However, it is not by configuration and requires a bit of coding.
This example handles an error that happens when users do something on the form (click on any buttons in this case). However, in my case, users even cannot load the form screen due to missing required roles. There is no Error action in redux to let me know there is a problem.
I tried this and I get both a Model/SET with NOT_FOUND action and Activity/ERROR. The error is both stored in the activity AND the models slice. I used the latest master, but the code should not have changed recently. If for whatever reason you really don’t see the error in the activity, you can fallback to the models slice (or Model/SET if you prefer, but we suggest to rather work with the state - as the error is persistent).
Hello @son-fast-shard, there are more options how to deal with permissions.
- As Baschir wrote, you should be able to reuse with redux actions. If you do not have them, there is probably another issue. Anyway:
- With takeLatest saga - error action and do some stuff (show popup, trigger new action, redirect to error page, …)
- With middleware you can also prevent the current action
Also you do not to watch on Activity/ERROR, but you can use another action based on your bussines requirements.
- Another option is that at the moment when the user is clicking on the button, you should know the user permissions. And again based on the logic, you could be e.g. able to disable the button, show some message, …
Hi @ofrinta, it’s absolutely a solution. However, the problem is I cannot find the Activity/ERROR from redux when the error happens. @bjaghoori has already helped me with this by creating the ticket A12C-2977. Thank you all a lot.