fixed project level permission bug
This commit is contained in:
parent
442ecff926
commit
09bb58e50e
@ -30,19 +30,19 @@ import DirectoryPage from "../Directory/DirectoryPage";
|
||||
import { useHasAnyPermission } from "../../hooks/useExpense";
|
||||
import { VIEW_PROJECTS } from "../../utils/constants";
|
||||
import { useNavigate, useRoutes } from "react-router-dom";
|
||||
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
||||
|
||||
const ProjectDetails = () => {
|
||||
|
||||
const projectId = useSelectedProject()
|
||||
const CanViewProject = useHasAnyPermission(VIEW_PROJECTS);
|
||||
const navigate = useNavigate()
|
||||
const projectId = useSelectedProject();
|
||||
const CanViewProject = useHasUserPermission(VIEW_PROJECTS);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { projectNames, fetchData } = useProjectName();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
if(!CanViewProject){
|
||||
navigate("/dashboard")
|
||||
if (!CanViewProject) {
|
||||
navigate("/dashboard");
|
||||
}
|
||||
if (projectId == null) {
|
||||
dispatch(setProjectId(projectNames[0]?.id));
|
||||
@ -56,7 +56,6 @@ const ProjectDetails = () => {
|
||||
refetch,
|
||||
} = useProjectDetails(projectId);
|
||||
|
||||
// const [activePill, setActivePill] = useState("profile");
|
||||
const [activePill, setActivePill] = useState(() => {
|
||||
return localStorage.getItem("lastActiveProjectTab") || "profile";
|
||||
});
|
||||
@ -80,7 +79,7 @@ const ProjectDetails = () => {
|
||||
|
||||
const handlePillClick = (pillKey) => {
|
||||
setActivePill(pillKey);
|
||||
localStorage.setItem("lastActiveProjectTab", pillKey); // ✅ Save to localStorage
|
||||
localStorage.setItem("lastActiveProjectTab", pillKey);
|
||||
};
|
||||
|
||||
const renderContent = () => {
|
||||
@ -136,7 +135,7 @@ const ProjectDetails = () => {
|
||||
<ProjectDocuments />
|
||||
</div>
|
||||
);
|
||||
case "setting":
|
||||
case "setting":
|
||||
return (
|
||||
<div className="row">
|
||||
<ProjectSetting />
|
||||
|
Loading…
x
Reference in New Issue
Block a user