import { useUserProfileStore } from "../context/zustand-store/userStore";

export const getAbleToSee = (page: string, access: string) => {
  let isAble;
  if (!access || !page) {
    isAble = "hidden";
  } else {
    const finded = useUserProfileStore
      .getState()
      ?.profile?.permissions?.find((item: any) => item.page_name === page);
    if (finded && finded.page_access.includes(access)) {
      isAble = "";
    } else {
      isAble = "hidden";
    }
  }

  return isAble;
};
