all completed tasks

This commit is contained in:
Николай Полтщук 2023-05-09 01:02:44 +03:00
parent 46a8373d00
commit b94ea09c54

View File

@ -39,7 +39,7 @@ export const Tracker = () => {
const [filteredAllTasks, setFilteredAllTasks] = useState([]); const [filteredAllTasks, setFilteredAllTasks] = useState([]);
const [loader, setLoader] = useState(false); const [loader, setLoader] = useState(false);
const [filterCompleteTasks, setFilterCompleteTasks] = useState([]); const [filterCompleteTasks, setFilterCompleteTasks] = useState([]);
// const [allCompletedTasks, setAllCompletedTasks] = useState([]) const [allCompletedTasks, setAllCompletedTasks] = useState([])
const [modalCreateProject, setModalCreateProject] = useState(false); const [modalCreateProject, setModalCreateProject] = useState(false);
@ -52,11 +52,16 @@ export const Tracker = () => {
).then((el) => { ).then((el) => {
dispatch(setAllProjects(el.projects)); dispatch(setAllProjects(el.projects));
setLoader(false); setLoader(false);
// setAllCompletedTasks(el.projects.filter((project) => { setAllCompletedTasks(el.projects.filter((project) => {
// if (project.status === 10 && project.columns.length) { if (project.status === 10 && project.columns.length) {
// return project return project
// } }
// }).map((project) => { return project.columns})) }).map((project) => { return project.columns}).reduce((acu, curr) => {
curr.forEach((item) => {
acu.push(...item.tasks)
})
return acu
}, []))
}); });
apiRequest( apiRequest(
`/task/get-user-tasks?user_id=${localStorage.getItem("id")}` `/task/get-user-tasks?user_id=${localStorage.getItem("id")}`