diff --git a/src/App.tsx b/src/App.tsx index c19b581..293d052 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -7,23 +7,33 @@ import { DndContext, DragEndEvent } from "@dnd-kit/core"; import { Flex } from "antd"; import { observer } from "mobx-react-lite"; import { useStore } from "./stores/store"; +import { useEffect } from "react"; +import { toJS } from "mobx"; function App() { const { taskStore } = useStore(); + useEffect(() => { + taskStore.loadTasks(); + }, [taskStore]); + + // taskStore.tasks.forEach((task) => console.log(task)); + + console.log(toJS(taskStore.tasks)); + function handleDragEnd(event: DragEndEvent) { const { active, over } = event; if (!over) return; const taskId = active.id as number; - const newStatus = over.id as Task["status"]; + const newStatus = over.id as Task["taskType"]; taskStore.tasks = taskStore.tasks.map((task) => task.id === taskId ? { ...task, - status: newStatus, + taskType: newStatus, } : task ); @@ -34,20 +44,18 @@ function App() { task.status === TaskStatus.Pending - )} + tasks={taskStore.tasks.filter((task) => task.taskType === "Pending")} /> task.status === TaskStatus.InProgress + (task) => task.taskType === TaskStatus.InProgress )} /> task.status === TaskStatus.Done + (task) => task.taskType === TaskStatus.Done )} /> diff --git a/src/api/agent.ts b/src/api/agent.ts index 9bd76ca..5b6b03a 100644 --- a/src/api/agent.ts +++ b/src/api/agent.ts @@ -23,6 +23,7 @@ const Tasks = { const agent = { Tasks, + responseBody, }; export default agent; diff --git a/src/features/Task/Task.component.tsx b/src/features/Task/Task.component.tsx index 2d8dcef..af2be29 100644 --- a/src/features/Task/Task.component.tsx +++ b/src/features/Task/Task.component.tsx @@ -44,7 +44,7 @@ const Task = ({ task }: Props) => { } }} > -

{task.status}

+

{task.text}