resolved merged conflict
This commit is contained in:
parent
1f6a85d507
commit
477cc5ab73
@ -7,17 +7,10 @@ import { setProjectId } from "../slices/localVariablesSlice";
|
|||||||
|
|
||||||
export const useProjects = () => {
|
export const useProjects = () => {
|
||||||
const { profile } = useProfile();
|
const { profile } = useProfile();
|
||||||
const dispatch = useDispatch();
|
|
||||||
const [projects, setProjects] = useState([]);
|
const [projects, setProjects] = useState([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
|
|
||||||
const fetchData = async () =>
|
|
||||||
{
|
|
||||||
console.log("calldd")
|
|
||||||
const projectIds = profile?.projects || [];
|
|
||||||
|
|
||||||
const projects_cache = getCachedData("projectslist");
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const projectIds = profile?.projects || [];
|
const projectIds = profile?.projects || [];
|
||||||
|
|
||||||
@ -26,7 +19,8 @@ export const useProjects = () => {
|
|||||||
.filter((proj) => projectIds.includes(String(proj.id)))
|
.filter((proj) => projectIds.includes(String(proj.id)))
|
||||||
.sort((a, b) => a.name.localeCompare(b.name));
|
.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
};
|
};
|
||||||
const projects_cache = getCachedData("projectList")
|
|
||||||
|
const projects_cache = getCachedData("projectslist");
|
||||||
|
|
||||||
if (!projects_cache) {
|
if (!projects_cache) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@ -50,20 +44,12 @@ export const useProjects = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect( () =>
|
|
||||||
{
|
|
||||||
|
|
||||||
if ( profile )
|
|
||||||
{
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (profile) {
|
if (profile) {
|
||||||
fetchData();
|
fetchData();
|
||||||
}
|
}
|
||||||
}, [profile]);
|
}, [profile]);
|
||||||
|
|
||||||
|
|
||||||
}, [profile]);
|
|
||||||
|
|
||||||
return { projects, loading, error, refetch: fetchData };
|
return { projects, loading, error, refetch: fetchData };
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -142,5 +128,5 @@ export const useProjectDetails = (projectId) => {
|
|||||||
}
|
}
|
||||||
}, [projectId, profile]);
|
}, [projectId, profile]);
|
||||||
|
|
||||||
return { projects_Details, loading, error, refetch: fetchData };
|
return { projects_Details, loading, error, refetch: fetchData }
|
||||||
};
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user