Commit dbfd910e authored by Kim, Subin's avatar Kim, Subin
Browse files

TodoList 가져오기

parent 6b854032
import { useState, useEffect } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import todoApi from "../../apis/todo.api";
import { useAuth } from "../../utils/context.js"; import { useAuth } from "../../utils/context.js";
import catchErrors from "../../utils/catchErrors";
import moment from "moment"; import moment from "moment";
import styles from "./menu.module.scss"; import styles from "./menu.module.scss";
const Menu = () => { const Menu = () => {
const { user, logout } = useAuth(); const { user, logout } = useAuth();
const [todoList, setTodoList] = useState([])
const [error, setError] = useState("");
useEffect(() => {
todayTodo()
}, [])
async function todayTodo() {
try {
setError("")
const result = await todoApi.getTodo(user.id, moment().format("YYYY-MM-DD"))
console.log("client resList",result)
setTodoList(result)
} catch (error) {
catchErrors(error, setError)
}
}
return ( return (
<> <>
......
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