I have a Redux reducer with the following state:
const INITIAL_STATE = {
permissions: [''],
authzError: null
};
I already have some Redux actions that modify state.permissions. I am writing the following action to run permission checks:
export function isAuthz(allowed, except) {
// I need state.permissions here
...
}
I know I can do this:
export function isAuthz(allowed, except, permissions) {
// Now do permission check
...
}
But this means pulling state.permissions out in the component and then putting it in the isAuthz action, which seems like a waste and error prone. I could just check permissions in the reducer, but I thought an action is where I am suppose to do this.
Where should I do this permission check and how do I get a hold of state.permissions ?
Thanks,
Warren