marco.pms.web/src/pages/Tenant/SelfTenantDetails.jsx
2025-08-23 10:33:26 +05:30

37 lines
951 B
JavaScript

import React, { useEffect, useMemo } from "react";
import { useProfile } from "../../hooks/useProfile";
import TenantDetails from "./TenantDetails";
import { hasUserPermission } from "../../utils/authUtils";
import { VIEW_TENANTS } from "../../utils/constants";
import { useNavigate } from "react-router-dom";
import Loader from "../../components/common/Loader";
const SelfTenantDetails = () => {
const { profile, loading } = useProfile();
const tenantId = profile?.employeeInfo?.tenantId;
const navigate = useNavigate();
const isSelfTenantView = hasUserPermission(VIEW_TENANTS);
useEffect(() => {
if (!isSelfTenantView) {
navigate("/tenants");
}
}, [isSelfTenantView, navigate]);
if (loading || !tenantId) {
return <Loader/>;
}
return (
<TenantDetails
tenantId={tenantId}
wrapInContainer={true}
showBreadcrumb={true}
iTSelf={true}
/>
);
};
export default SelfTenantDetails;