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
74f2c338
Commit
74f2c338
authored
Jan 20, 2021
by
kusang96
Browse files
dd
parent
4815e070
Changes
3
Hide whitespace changes
Inline
Side-by-side
client/src/Pages/ProductsList.js
View file @
74f2c338
...
@@ -5,7 +5,6 @@ import Pagination from '../Components/Pagination';
...
@@ -5,7 +5,6 @@ import Pagination from '../Components/Pagination';
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
catchError
from
'
../utils/catchErrors
'
;
import
catchError
from
'
../utils/catchErrors
'
;
import
{
isAuthenticated
}
from
'
../utils/auth
'
;
import
{
isAuthenticated
}
from
'
../utils/auth
'
;
import
catchError
from
'
../utils/catchErrors
'
;
import
{
Container
,
Row
,
Col
,
Form
,
FormControl
,
Button
,
Dropdown
}
from
'
react-bootstrap
'
;
import
{
Container
,
Row
,
Col
,
Form
,
FormControl
,
Button
,
Dropdown
}
from
'
react-bootstrap
'
;
function
ProductsList
({
match
})
{
function
ProductsList
({
match
})
{
...
...
client/src/utils/auth.js
View file @
74f2c338
import
axios
from
"
axios
"
;
import
axios
from
"
axios
"
;
export
function
handleLogin
({
userId
,
role
,
name
})
{
export
function
handleLogin
({
userId
,
role
,
name
,
tel
})
{
localStorage
.
setItem
(
'
id
'
,
userId
)
localStorage
.
setItem
(
'
id
'
,
userId
)
localStorage
.
setItem
(
'
role
'
,
role
)
localStorage
.
setItem
(
'
role
'
,
role
)
localStorage
.
setItem
(
'
name
'
,
name
)
localStorage
.
setItem
(
'
name
'
,
name
)
localStorage
.
setItem
(
'
tel
'
,
tel
)
}
}
export
async
function
handleLogout
()
{
export
async
function
handleLogout
()
{
localStorage
.
removeItem
(
'
id
'
)
localStorage
.
clear
()
localStorage
.
removeItem
(
'
role
'
)
localStorage
.
removeItem
(
'
name
'
)
await
axios
.
get
(
'
/api/auth/logout
'
)
await
axios
.
get
(
'
/api/auth/logout
'
)
window
.
location
.
href
=
'
/
'
window
.
location
.
href
=
'
/
'
}
}
...
...
server/controllers/auth.controller.js
View file @
74f2c338
...
@@ -7,7 +7,7 @@ const login = async (req, res) => {
...
@@ -7,7 +7,7 @@ const login = async (req, res) => {
const
{
id
,
password
}
=
req
.
body
const
{
id
,
password
}
=
req
.
body
console
.
log
(
id
,
password
)
console
.
log
(
id
,
password
)
try
{
try
{
const
user
=
await
User
.
findOne
({
id
}).
select
(
'
password role name
'
)
const
user
=
await
User
.
findOne
({
id
}).
select
(
'
password role name
tel
'
)
console
.
log
(
'
u=
'
,
user
)
console
.
log
(
'
u=
'
,
user
)
if
(
!
user
)
{
if
(
!
user
)
{
return
res
.
status
(
404
).
send
(
`
${
id
}
가 존재하지 않습니다.`
)
return
res
.
status
(
404
).
send
(
`
${
id
}
가 존재하지 않습니다.`
)
...
@@ -23,7 +23,7 @@ const login = async (req, res) => {
...
@@ -23,7 +23,7 @@ const login = async (req, res) => {
httpOnly
:
true
,
httpOnly
:
true
,
secure
:
config
.
env
===
'
production
'
secure
:
config
.
env
===
'
production
'
})
})
res
.
json
({
userId
:
user
.
_id
,
role
:
user
.
role
,
name
:
user
.
name
})
res
.
json
({
userId
:
user
.
_id
,
role
:
user
.
role
,
name
:
user
.
name
,
tel
:
user
.
tel
})
}
else
{
}
else
{
res
.
status
(
401
).
send
(
'
비밀번호가 일치하지 않습니다.
'
)
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