Commit 909484f0 authored by 박상호's avatar 박상호 🎼
Browse files

Merge remote-tracking branch 'origin/jaeyeon' into who

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