#51 try to optimize mmyTasks, no result

parent 61f618b6
......@@ -58,20 +58,18 @@ function stableSort(array, comparator) {
export default function EnhancedTable() {
const dispatch = useDispatch();
useEffect(() => {
dispatch(fetchAllTasks());
dispatch(fetch)
}, [dispatch]);
const tasks = useSelector((state) => state.tasks.tasks);
console.log(tasks)
const [recievedTasks, setRecievedTasks] = useState([]);
const [projects,setProjects]=useState([])
// const projects=[
// "project1",
// "project2",
// "project3"
// ]
const [projects,setProjects]=useState(['1','2'])
useEffect(() => {
dispatch(fetchAllTasks());
}, [dispatch]);
const [order, setOrder] = React.useState("asc");
const [orderBy, setOrderBy] = React.useState("id");
......@@ -257,6 +255,7 @@ console.log(tasks)
onClick={() => {
addTask();
}}
projects={projects}
onClose={onClose}
projectName={projectName}
......
......@@ -156,7 +156,7 @@ export const fetchTasksByProject = (projects) => {
return async (dispatch) => {
dispatch(fetchTasksByProjectRequest());
try {
await axios.post("/tasks/project", projects);
const response =await axios.post("/tasks/project", projects);
dispatch(fetchTasksByProjectSuccess(response.data.tasks))
} catch (error) {
dispatch(fetchTasksByProjectFailure(error.response.data));
......
......@@ -13,6 +13,9 @@ import {
DELETE_TASK_FAILURE,
FETCH_ALL_TASKS_SUCCESS,
EDIT_CALENDAR_TASK,
FETCH_TASKS_BY_PROJECT_REQUEST,
FETCH_TASKS_BY_PROJECT_SUCCESS,
FETCH_TASKS_BY_PROJECT_FAILURE
} from "../actionTypes/tasksTypes";
const initialState = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment