// @ts-ignore
export default (initialState) => {
	const permissions = initialState?.currentUserPermission?.map(
		(permissionVO: BusinessAPI.PermissionVO) => permissionVO.slug,
	);

	// 在这里按照初始化数据定义项目中的权限，统一管理
	// 参考文档 https://umijs.org/docs/max/access
	return {
		permission: (permission: BusinessAPI.PermissionVO['slug']): boolean => {
			return permissions?.indexOf(permission) > -1 || true;
		},
	};
};
