Commit 8c182ca7 authored by Lee SeoYeon's avatar Lee SeoYeon
Browse files

.

parent 36865695
This diff is collapsed.
...@@ -18,17 +18,17 @@ function App() { ...@@ -18,17 +18,17 @@ function App() {
const handleChange = (e) => { const handleChange = (e) => {
setSearch(e.target.value); setSearch(e.target.value);
} } //바뀌는 것이 있을때 이벤트 발생
const handleSubmit = () => { const handleSubmit = () => {
setState(true); setState(true);
} } //submit 버튼을 누르면 state 값을 true로 바뀐다
return ( return (
<Container className="vh-100 d-flex justify-content-md-center align-items-center"> <Container className="vh-100 d-flex justify-content-md-center align-items-center">
<Col md={6} style={{ marginTop: 140 }}> <Col md={6} style={{ marginTop: 140 }}>
<Nav className="justify-content-end" bg="#fff" variant="light" > <Nav className="justify-content-end" bg="#fff" variant="light" >
{user ? <Nav.Links={() => handleLogout()}>로그아웃</Nav.Link> {user ? <Nav.Link onClick={() => handleLogout()}>로그아웃</Nav.Link>
: ( : (
<> <>
<Nav.Link href="/signup">회원가입</Nav.Link> <Nav.Link href="/signup">회원가입</Nav.Link>
......
import axios from "axios" import axios from "axios"
export function handleLogin(userId) { export function handleLogin(userId) { //로그인할때 로컬스토리지에 유저 아이디를 설정한다
localStorage.setItem('loginStatus', userId) localStorage.setItem('loginStatus', userId)
} }
export async function handleLogout() { export async function handleLogout() {
localStorage.removeItem('loginStatus') localStorage.removeItem('loginStatus') //로컬스토리지에서 로그인상태를 지운다
await axios.get('/api/auth/logout') await axios.get('/api/auth/logout') //?
window.location.href='/' //경로 지정 window.location.href='/' //경로 지정
} }
//유저가 로그인 했는 지 확인하는 함수 //유저가 로그인 했는 지 확인하는 함수
......
This diff is collapsed.
...@@ -8,14 +8,14 @@ router.route('/api/users/signup') ...@@ -8,14 +8,14 @@ router.route('/api/users/signup')
router.param('userId', userCtrl.userById) router.param('userId', userCtrl.userById)
router.get('/admin/:_id', verifyToken, function (req, res, next) { // router.get('/admin/:_id', verifyToken, function (req, res, next) {
console.log('/reserves/admin get req.params', req.params) // console.log('/reserves/admin get req.params', req.params)
Reserve.find({ approve: false }).populate('user').exec(function (err, reserve) { // Reserve.find({ approve: false }).populate('user').exec(function (err, reserve) {
if (err) return res.status(500).json({ error: err }); // if (err) return res.status(500).json({ error: err });
console.log('reserve list', reserve) // console.log('reserve list', reserve)
res.status(201).json(reserve); // res.status(201).json(reserve);
}) // })
}); // });
export default router export default router
\ No newline at end of file
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