Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
Today KU
Commits
dbfd910e
Commit
dbfd910e
authored
Nov 05, 2021
by
Kim, Subin
Browse files
TodoList 가져오기
parent
6b854032
Changes
1
Show whitespace changes
Inline
Side-by-side
client/src/components/Menu/Menu.js
View file @
dbfd910e
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
(
<>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment