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
shopping-mall
Commits
909484f0
Commit
909484f0
authored
Jan 11, 2021
by
박상호
🎼
Browse files
Merge remote-tracking branch 'origin/jaeyeon' into who
parents
486fd7e2
a645a94a
Changes
3
Hide whitespace changes
Inline
Side-by-side
client/src/Pages/Login.js
View file @
909484f0
...
...
@@ -31,8 +31,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
)
...
...
client/src/utils/Auth.js
View file @
909484f0
import
axios
from
"
axios
"
export
function
handleLogin
(){
localStorage
.
setItem
(
'
loginStatus
'
,
'
true
'
)
export
function
handleLogin
(
userId
){
localStorage
.
setItem
(
'
loginStatus
'
,
userId
)
}
export
async
function
handleLogout
(){
...
...
server/controllers/auth.controller.js
View file @
909484f0
...
...
@@ -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
(
'
비밀번호가 일치하지 않습니다.
'
)
}
...
...
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