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

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