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
messenger
Commits
b84511b5
Commit
b84511b5
authored
Jan 08, 2021
by
우지원
Browse files
링크추가
parent
c748afc4
Changes
3
Hide whitespace changes
Inline
Side-by-side
client/src/Components/Menu.js
View file @
b84511b5
import
React
from
'
react
'
import
{
Navbar
,
Nav
,
Button
}
from
'
react-bootstrap
'
;
import
{
Link
}
from
'
react-router-dom
'
;
import
{
handleLogout
}
from
'
../utils/auth
'
;
function
Menu
()
{
...
...
@@ -14,7 +15,9 @@ function Menu() {
<
Nav
.
Link
href
=
"
/profile
"
>
Profile
<
/Nav.Link
>
<
Nav
.
Link
href
=
"
/hello
"
>
Hello
<
/Nav.Link
>
<
/Nav
>
<
Button
onClick
=
{()
=>
handleLogout
()}
variant
=
"
light
"
className
=
"
ml-3
"
>
Logout
<
/Button
>
<
Link
to
=
"
./login
"
>
<
Button
onClick
=
{()
=>
handleLogout
()}
variant
=
"
light
"
className
=
"
ml-3
"
>
Logout
<
/Button
>
<
/Link
>
<
/Navbar
>
)
}
...
...
client/src/Pages/SignUpPage.js
View file @
b84511b5
...
...
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import
axios
from
'
axios
'
import
{
Button
,
Form
,
Container
,
Navbar
,
Alert
}
from
'
react-bootstrap
'
;
import
catchErrors
from
'
../utils/catchErrors
'
;
//
import { Redirect } from 'react-router-dom';
import
{
Redirect
}
from
'
react-router-dom
'
;
const
INIT_USER
=
{
username
:
''
,
...
...
@@ -16,6 +16,7 @@ function SingUp() {
const
[
user
,
setUser
]
=
useState
(
INIT_USER
)
const
[
error
,
setError
]
=
useState
(
''
)
const
[
disabled
,
setDisabled
]
=
useState
(
true
)
const
[
success
,
setSucces
]
=
useState
(
false
)
useEffect
(()
=>
{
const
isUser
=
Object
.
values
(
user
).
every
(
el
=>
Boolean
(
el
))
...
...
@@ -62,15 +63,16 @@ function SingUp() {
// ?????????hash 처리된 password가 저장되지 않았음
// setUser(INIT_USER)
setSucces
(
true
)
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
}
//
if (success) {
//
console.log('success', success)
//
return <Redirect to='/login'/>
//
}
if
(
success
)
{
console
.
log
(
'
success
'
,
success
)
return
<
Redirect
to
=
'
/login
'
/>
}
return
(
...
...
server/controllers/auth.controller.js
View file @
b84511b5
...
...
@@ -49,14 +49,14 @@ const login = async (req, res) => {
}
catch
(
error
)
{
//알수없는 모든 에러발생시 처리
console
.
log
(
error
)
res
.
status
(
500
).
send
(
'
로그인 에러
'
)
res
.
status
(
500
).
send
(
'
로그인 에러
가 발생하였습니다
'
)
}
}
const
logout
=
(
req
,
res
)
=>
{
res
.
clearCookie
(
'
token
'
)
res
.
send
(
'
Logout Successful
'
)
res
.
send
(
'
로그아웃 되었습니다
'
)
}
export
default
{
login
,
logout
}
...
...
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