vn-verdnaturachat/app/actions/permissions.ts

29 lines
728 B
TypeScript
Raw Normal View History

import { Action } from 'redux';
import { IPermissionsState, TSupportedPermissions } from '../reducers/permissions';
import { PERMISSIONS } from './actionsTypes';
interface ISetPermissions extends Action {
permissions: IPermissionsState;
}
interface IUpdatePermissions extends Action {
payload: { id: TSupportedPermissions; roles: string[] };
}
export type TActionPermissions = ISetPermissions & IUpdatePermissions;
export function setPermissions(permissions: IPermissionsState): ISetPermissions {
return {
type: PERMISSIONS.SET,
permissions
};
}
export function updatePermission(id: TSupportedPermissions, roles: string[]): IUpdatePermissions {
return {
type: PERMISSIONS.UPDATE,
payload: { id, roles }
};
}