добавила функцию HandleEdit Task, удалила лишние файлы

parent 9a852f06
...@@ -3,7 +3,7 @@ import TableCell from "@mui/material/TableCell"; ...@@ -3,7 +3,7 @@ import TableCell from "@mui/material/TableCell";
import Input from "@mui/material/Input"; import Input from "@mui/material/Input";
const CustomTableCell = ({ task, name, value, onChange, onModalOpen }) => { const CustomTableCell = ({ task, name, value, onChange, onModalOpen }) => {
const styles = { width: "auto", height: "40px" }; const styles = { width: "auto", height: "10px"};
if (task) { if (task) {
return ( return (
......
This diff is collapsed.
...@@ -23,7 +23,7 @@ import MyTaskToolBar from "../../components/MyTasksCompoments/MyTaskToolBar"; ...@@ -23,7 +23,7 @@ import MyTaskToolBar from "../../components/MyTasksCompoments/MyTaskToolBar";
import CustomTableCell from "../../components/MyTasksCompoments/CustomTableCell1"; import CustomTableCell from "../../components/MyTasksCompoments/CustomTableCell1";
import MaterialUIPickers from "../../components/MyTasksCompoments/DateTimePicker/DateTimePicker"; import MaterialUIPickers from "../../components/MyTasksCompoments/DateTimePicker/DateTimePicker";
import BasicSelect from "../../components/UI/Select/Select"; import BasicSelect from "../../components/UI/Select/Select";
import { fetchAllTasks, deleteTask } from "../../store/actions/tasksActions"; import { fetchAllTasks, deleteTask,editTask,addTask } from "../../store/actions/tasksActions";
function descendingComparator(a, b, orderBy) { function descendingComparator(a, b, orderBy) {
if (b[orderBy] < a[orderBy]) { if (b[orderBy] < a[orderBy]) {
...@@ -156,6 +156,10 @@ console.log(tasks) ...@@ -156,6 +156,10 @@ console.log(tasks)
setRecievedTasks(newTasks); setRecievedTasks(newTasks);
}; };
const HandleEditTask=(task)=>{
dispatch(editTask(task))
}
const addTask = () => { const addTask = () => {
// let newTasks=[...tasks] // let newTasks=[...tasks]
tasks.unshift({ tasks.unshift({
...@@ -216,13 +220,13 @@ console.log(tasks) ...@@ -216,13 +220,13 @@ console.log(tasks)
rowCount={tasks.length} rowCount={tasks.length}
/> />
<TableBody> <TableBody>
<TableRow> <TableRow sx={{height:'1px',margin:0,padding:0}}>
<TableCell align="left"> <TableCell align="left">
<Input value={order} name="order" /> <Input sx={{height:'1px',margin:0,padding:0}} value={''} name="order" />
</TableCell> </TableCell>
<TableCell align="left"> <TableCell align="left">
<Input value={orderBy} name="orderBy" /> <Input sx={{height:'1px',margin:0,padding:0}} value={''} name="orderBy" />
</TableCell> </TableCell>
</TableRow> </TableRow>
...@@ -306,7 +310,7 @@ console.log(tasks) ...@@ -306,7 +310,7 @@ console.log(tasks)
{task.isEditMode ? ( {task.isEditMode ? (
<IconButton <IconButton
aria-label="done" aria-label="done"
onClick={() => {onToggleEditMode(task.id, false, true); editTask(task) }} onClick={() => {onToggleEditMode(task.id); HandleEditTask(task) }}
> >
<Done /> <Done />
</IconButton> </IconButton>
......
...@@ -101,11 +101,12 @@ export const editTask = (task) => { ...@@ -101,11 +101,12 @@ export const editTask = (task) => {
const token = getState().users?.user?.token; const token = getState().users?.user?.token;
try { try {
console.log(task) console.log(task)
await axios.put("/tasks", task, { const r=await axios.put("/tasks", task, {
headers: { headers: {
'Authorization': 'IwGVRaksGTWtnKlOZd7zJ' 'Authorization': 'IwGVRaksGTWtnKlOZd7zJ'
} }
}); });
console.log(r)
dispatch(editTaskSuccess()) dispatch(editTaskSuccess())
dispatch(fetchAllTasks()) dispatch(fetchAllTasks())
dispatch(fetchCalendarTasks()) dispatch(fetchCalendarTasks())
......
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