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
search-page
Commits
8c182ca7
Commit
8c182ca7
authored
Jan 24, 2021
by
Lee SeoYeon
Browse files
.
parent
36865695
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
client/.eslintcache
View file @
8c182ca7
This diff is collapsed.
Click to expand it.
client/src/App.js
View file @
8c182ca7
...
@@ -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
.
Link
s
=
{()
=>
handleLogout
()}
>
로그아웃
<
/Nav.Link
>
{
user
?
<
Nav
.
Link
onClick
=
{()
=>
handleLogout
()}
>
로그아웃
<
/Nav.Link
>
:
(
:
(
<>
<>
<
Nav
.
Link
href
=
"
/signup
"
>
회원가입
<
/Nav.Link
>
<
Nav
.
Link
href
=
"
/signup
"
>
회원가입
<
/Nav.Link
>
...
...
client/src/utils/auth.js
View file @
8c182ca7
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
=
'
/
'
//경로 지정
}
}
//유저가 로그인 했는 지 확인하는 함수
//유저가 로그인 했는 지 확인하는 함수
...
...
googleSearch
View file @
8c182ca7
This diff is collapsed.
Click to expand it.
server/controllers/place.controller.js
View file @
8c182ca7
server/routes/user.routes.js
View file @
8c182ca7
...
@@ -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
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