import { useState, useEffect } from "react"; import { Link } from "react-router-dom"; import todoApi from "../../apis/todo.api"; import { useAuth } from "../../utils/context.js"; import catchErrors from "../../utils/catchErrors"; import moment from "moment"; import styles from "./menu.module.scss"; const Menu = () => { 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 ( <>
> ) } export default Menu