removed unnecessary code
This commit is contained in:
parent
3c993221f3
commit
c1b972a759
@ -2,8 +2,11 @@ import { useEffect, useState } from "react";
|
||||
import { cacheData, getCachedData } from "../slices/apiDataManager";
|
||||
import ProjectRepository from "../repositories/ProjectRepository";
|
||||
import { useProfile } from "./useProfile";
|
||||
import {useDispatch} from "react-redux";
|
||||
|
||||
export const useProjects = () => {
|
||||
export const useProjects = () =>
|
||||
{
|
||||
const dispatch = useDispatch
|
||||
const [projects, setProjects] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
@ -22,7 +25,8 @@ export const useProjects = () => {
|
||||
|
||||
setProjects(sortedProject);
|
||||
|
||||
cacheData("projectslist", sortedProject);
|
||||
cacheData( "projectslist", sortedProject );
|
||||
|
||||
setLoading(false);
|
||||
})
|
||||
.catch((error) => {
|
||||
@ -35,7 +39,8 @@ export const useProjects = () => {
|
||||
const sortedProject = [...projects].sort((a, b) =>
|
||||
a.name.localeCompare(b.name)
|
||||
);
|
||||
setProjects(sortedProject);
|
||||
setProjects( sortedProject );
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ import { useDispatch, useSelector } from "react-redux";
|
||||
import { useProjectDetails, useProjects } from "../../hooks/useProjects";
|
||||
import { setProjectId } from "../../slices/localVariablesSlice";
|
||||
|
||||
var projectId;
|
||||
|
||||
const TaskPlannng = () => {
|
||||
|
||||
const {profile} = useProfile();
|
||||
@ -26,10 +26,6 @@ const TaskPlannng = () => {
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState("");
|
||||
useEffect( () =>
|
||||
{
|
||||
dispatch(setProjectId(projects[0]?.id))
|
||||
},[projects])
|
||||
|
||||
const fetchActivities = async () => {
|
||||
try {
|
||||
@ -86,7 +82,7 @@ const TaskPlannng = () => {
|
||||
};
|
||||
|
||||
const handleDataChange = (data) => {
|
||||
console.log("datachange")
|
||||
|
||||
fetchData();
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user