resolved merge conflict
This commit is contained in:
parent
4b3f8cc50f
commit
098aa9749f
@ -12,6 +12,11 @@ export const useProjects = () => {
|
|||||||
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 projects_cache = getCachedData("projectslist");
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const projectIds = profile?.projects || [];
|
const projectIds = profile?.projects || [];
|
||||||
@ -21,6 +26,7 @@ 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")
|
||||||
|
|
||||||
if (!projects_cache) {
|
if (!projects_cache) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@ -44,12 +50,20 @@ 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 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user