resolved merged conflict

This commit is contained in:
Pramod Mahajan 2025-05-05 17:30:09 +05:30
parent 1f6a85d507
commit 477cc5ab73

View File

@ -7,17 +7,10 @@ import { setProjectId } from "../slices/localVariablesSlice";
export const useProjects = () => {
const { profile } = useProfile();
const dispatch = useDispatch();
const [projects, setProjects] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState("");
const fetchData = async () =>
{
console.log("calldd")
const projectIds = profile?.projects || [];
const projects_cache = getCachedData("projectslist");
const fetchData = async () => {
const projectIds = profile?.projects || [];
@ -26,7 +19,8 @@ export const useProjects = () => {
.filter((proj) => projectIds.includes(String(proj.id)))
.sort((a, b) => a.name.localeCompare(b.name));
};
const projects_cache = getCachedData("projectList")
const projects_cache = getCachedData("projectslist");
if (!projects_cache) {
setLoading(true);
@ -44,26 +38,18 @@ export const useProjects = () => {
} else {
if (!projects.length) {
const filtered = filterProjects(projects_cache);
setProjects( filtered );
setProjects(filtered);
setLoading(false);
}
}
};
useEffect( () =>
{
if ( profile )
{
useEffect(() => {
if (profile) {
fetchData();
}
}, [profile]);
}, [profile]);
return { projects, loading, error, refetch: fetchData };
};
@ -142,5 +128,5 @@ export const useProjectDetails = (projectId) => {
}
}, [projectId, profile]);
return { projects_Details, loading, error, refetch: fetchData };
};
return { projects_Details, loading, error, refetch: fetchData }
}