Commit a645a94a authored by 이재연's avatar 이재연
Browse files

로그인 로그아웃 끝.

parent f53b58dc
......@@ -34,8 +34,8 @@ function Login() {
setValidated(true);
try {
setError('')
await axios.post('/api/auth/login', user)
handleLogin()
const response=await axios.post('/api/auth/login', user)
handleLogin(response.data.userId)
setSuccess(true)
} catch (error) {
catchErrors(error, setError)
......
import axios from "axios"
export function handleLogin(){
localStorage.setItem('loginStatus','true')
export function handleLogin(userId){
localStorage.setItem('loginStatus',userId)
}
export async function handleLogout(){
......
......@@ -23,7 +23,8 @@ const login = async(req,res)=>{
httpOnly:true,
secure:config.env ==='production'
})
res.send('로그인 되었습니다.')
res.json({userId:user._id})
}else{
res.status(401).send('비밀번호가 일치하지 않습니다.')
}
......
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