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
reservation-service
Commits
1e75d62c
Commit
1e75d62c
authored
Nov 06, 2020
by
Yoon, Daeki
😅
Browse files
api changed
parent
2e9e6170
Changes
15
Hide whitespace changes
Inline
Side-by-side
client/src/Components/Card.js
View file @
1e75d62c
...
...
@@ -47,7 +47,7 @@ function Notice({ card_id, card_index, title, date, content, admin }) {
}
function
remove
(
card_id
)
{
axios
.
delete
(
`/notices/
${
card_id
}
`
)
axios
.
delete
(
`/
api/
notices/
${
card_id
}
`
)
.
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
alert
(
"
삭제되었습니다!
"
);
...
...
client/src/Components/Menu.js
View file @
1e75d62c
...
...
@@ -28,7 +28,7 @@ function Menu() {
},
[])
function
acheck
()
{
axios
.
get
(
`/users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
axios
.
get
(
`/
api/
users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
}).
then
(
res
=>
{
if
(
res
.
data
.
role
==
"
admin
"
)
{
...
...
client/src/Components/Schedule.js
View file @
1e75d62c
...
...
@@ -20,7 +20,7 @@ function Cal(props) {
});
function
getReserve
(
room
)
{
axios
.
get
(
`/reserves/room/
${
room
}
`
,
{
axios
.
get
(
`/
api/
reserves/room/
${
room
}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
...
...
client/src/Pages/ACheckPage.js
View file @
1e75d62c
...
...
@@ -31,7 +31,7 @@ function ACheck(props) {
},
[])
function
getReserve
()
{
axios
.
get
(
`/users/admin/
${
props
.
match
.
params
.
id
}
`
,
{
axios
.
get
(
`/
api/
users/admin/
${
props
.
match
.
params
.
id
}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
...
...
@@ -48,7 +48,7 @@ function ACheck(props) {
if
(
state
)
return
<
Redirect
to
=
"
/
"
/>
;
function
remove
(
index
)
{
axios
.
put
(
`/reserves/
${
reserve
[
index
].
_id
}
`
)
axios
.
put
(
`/
api/
reserves/
${
reserve
[
index
].
_id
}
`
)
.
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
alert
(
"
승인을 거절했습니다!
"
);
...
...
@@ -60,7 +60,7 @@ function ACheck(props) {
};
function
admit
(
index
)
{
axios
.
put
(
`/reserves/
${
reserve
[
index
].
_id
}
`
,
{
axios
.
put
(
`/
api/
reserves/
${
reserve
[
index
].
_id
}
`
,
{
approve
:
true
,
})
.
then
(
res
=>
{
...
...
client/src/Pages/ApplyPage.js
View file @
1e75d62c
...
...
@@ -46,7 +46,7 @@ function Apply(props) {
}
function
getUser
()
{
axios
.
get
(
`/users/
${
props
.
match
.
params
.
id
}
`
,
{
axios
.
get
(
`/
api/
users/
${
props
.
match
.
params
.
id
}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
...
...
@@ -100,7 +100,7 @@ function Apply(props) {
addRoomInfo
(
values
);
axios
({
method
:
'
post
'
,
url
:
'
/reserves
'
,
url
:
'
/
api/
reserves
'
,
data
:
values
}).
then
(
res
=>
{
if
(
res
.
status
===
404
)
{
...
...
client/src/Pages/ChangePage.js
View file @
1e75d62c
...
...
@@ -12,9 +12,9 @@ const Check = styled.div`
content: '새로운 비밀번호를 다시 입력하세요';
}
& #reCheck:not(.right) {
content: '비밀번호가 일치하지 않습니다.';
& #reCheck:not(.right)::after {
color: red;
content: "비밀번호가 일치하지 않습니다";
}
`
...
...
@@ -29,12 +29,12 @@ function Change(props) {
return
(
<
div
className
=
""
>
{(
localStorage
.
getItem
(
"
token
"
)
!==
null
)
?
(
<
Menu
/>
)
:
(
<
Menu
expand
=
"
md
"
variant
=
"
dark
"
>
<
Navbar
.
Brand
>
회원가입
<
/Navbar.Brand
>
<
/Menu
>
)}
<
Menu
/>
)
:
(
<
Menu
expand
=
"
md
"
variant
=
"
dark
"
>
<
Navbar
.
Brand
>
회원가입
<
/Navbar.Brand
>
<
/Menu
>
)}
<
Container
fluid
className
=
"
p-0 vh-90
"
>
<
Check
className
=
"
row justify-content-center m-0
"
>
<
Col
md
=
{
4
}
className
=
"
pt-5
"
>
...
...
@@ -50,7 +50,7 @@ function Change(props) {
.
oneOf
([
Yup
.
ref
(
"
password
"
),
null
],
'
비밀번호가 일치하지 않습니다.
'
),
})}
onSubmit
=
{(
values
,
{
setSubmitting
})
=>
{
axios
.
put
(
`/users/change/
${
props
.
location
.
state
.
id
}
`
,
{
...
values
},
axios
.
put
(
`/
api/
users/change/
${
props
.
location
.
state
.
id
}
`
,
{
...
values
},
)
.
then
(
res
=>
{
console
.
log
(
res
.
data
);
...
...
@@ -87,7 +87,7 @@ function Change(props) {
<
/div
>
<
div
className
=
"
form-group
"
>
{
touched
.
password2
&&
errors
.
password2
?
setCheckPw
(
false
)
:
null
}
{
touched
.
password2
&&
errors
.
password2
?
setCheckPw
(
false
)
:
setCheckPw
(
true
)
}
<
div
id
=
"
reCheck
"
className
=
{
checkPw
?
"
right
"
:
"
err
"
}
><
/div
>
<
input
className
=
{(
touched
.
password2
&&
errors
.
password2
?
'
form-control is-invalid
'
:
"
form-control
"
)}
...
...
client/src/Pages/CheckPage.js
View file @
1e75d62c
...
...
@@ -37,7 +37,7 @@ function Check(props) {
if
(
state
)
return
<
Redirect
to
=
"
/
"
/>
;
function
getReserve
()
{
axios
.
get
(
`/reserves/
${
props
.
match
.
params
.
id
}
`
,
{
axios
.
get
(
`/
api/
reserves/
${
props
.
match
.
params
.
id
}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
...
...
@@ -59,7 +59,7 @@ function Check(props) {
});
}
function
remove
(
index
)
{
axios
.
delete
(
`/reserves/
${
reserve
[
index
].
_id
}
`
)
axios
.
delete
(
`/
api/
reserves/
${
reserve
[
index
].
_id
}
`
)
.
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
alert
(
"
삭제되었습니다!
"
);
...
...
client/src/Pages/FindPage.js
View file @
1e75d62c
...
...
@@ -43,7 +43,7 @@ function Find() {
onSubmit
=
{(
values
,
{
setSubmitting
})
=>
{
axios
({
method
:
'
post
'
,
url
:
'
/login/find
'
,
url
:
'
/
api/
login/find
'
,
data
:
values
,
}).
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
...
...
client/src/Pages/HomePage.js
View file @
1e75d62c
...
...
@@ -16,7 +16,7 @@ function Home() {
if
(
state
)
return
<
Redirect
to
=
"
/
"
/>
;
function
tcheck
()
{
axios
.
get
(
`/users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
axios
.
get
(
`/
api/
users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
...
...
client/src/Pages/LoginPage.js
View file @
1e75d62c
...
...
@@ -125,7 +125,7 @@ function Login() {
onSubmit
=
{(
values
,
{
setSubmitting
})
=>
{
axios
({
method
:
'
post
'
,
url
:
'
/login
'
,
url
:
'
/
api/
login
'
,
data
:
values
,
}).
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
...
...
client/src/Pages/ModifyPage.js
View file @
1e75d62c
...
...
@@ -25,7 +25,7 @@ function Modify({ match }) {
function
getOne
(
id
)
{
if
(
id
)
{
axios
.
get
(
`/notices/
${
match
.
params
.
id
}
`
)
axios
.
get
(
`/
api/
notices/
${
match
.
params
.
id
}
`
)
.
then
(
res
=>
{
if
(
res
.
status
!==
201
)
{
alert
(
res
.
data
.
error
);
...
...
@@ -39,7 +39,7 @@ function Modify({ match }) {
};
function
acheck
()
{
axios
.
get
(
`/users/admin/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
axios
.
get
(
`/
api/
users/admin/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
...
...
@@ -73,7 +73,7 @@ function Modify({ match }) {
onSubmit
=
{(
values
,
{
setSubmitting
})
=>
{
axios
({
method
:
'
put
'
,
url
:
`/writes/
${
match
.
params
.
id
}
`
,
url
:
`/
api/
writes/
${
match
.
params
.
id
}
`
,
data
:
values
,
})
.
then
(
res
=>
{
...
...
client/src/Pages/NoticePage.js
View file @
1e75d62c
...
...
@@ -18,7 +18,7 @@ function Notice() {
if
(
state
)
return
<
Redirect
to
=
"
/
"
/>
;
function
acheck
()
{
axios
.
get
(
`/users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
axios
.
get
(
`/
api/
users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
...
...
@@ -36,7 +36,7 @@ function Notice() {
}
function
getNotice
()
{
axios
.
get
(
`/notices`
)
axios
.
get
(
`/
api/
notices`
)
.
then
(
res
=>
{
console
.
log
(
'
res.data=
'
,
res
.
data
)
if
(
res
.
status
!==
201
)
{
...
...
client/src/Pages/SignupPage.js
View file @
1e75d62c
...
...
@@ -17,147 +17,147 @@ const Menu = styled(Navbar)`
const
Wow
=
styled
.
div
`
height: 90vh;
& #reCheck:
:
after {
content:
'
비밀번호를 다시 입력하세요
'
;
& #reCheck:after {
content:
"
비밀번호를 다시 입력하세요
"
;
}
& #reCheck:not(.right) {
content: '비밀번호가 일치하지 않습니다.';
& #reCheck:not(.right)::after {
color: red;
content: "비밀번호가 일치하지 않습니다";
}
`
function
Signup
()
{
const
[
state
,
setState
]
=
useState
(
false
);
const
[
checkPw
,
setCheckPw
]
=
useState
(
true
);
const
[
state
,
setState
]
=
useState
(
false
);
const
[
checkPw
,
setCheckPw
]
=
useState
(
true
);
if
(
state
)
{
return
<
Redirect
to
=
"
/login
"
/>
;
}
return
(
<
div
className
=
"
vh-100
"
>
<
Menu
expand
=
"
md
"
variant
=
"
dark
"
>
<
Navbar
.
Brand
>
회원가입
<
/Navbar.Brand
>
<
/Menu
>
<
Container
fluid
>
<
Wow
className
=
"
row justify-content-center
"
>
<
Col
md
=
{
3
}
xs
=
{
11
}
className
=
"
p-0
"
>
<
Formik
initialValues
=
{{
name
:
''
,
id
:
''
,
password
:
''
,
password2
:
''
,
question
:
''
,
answer
:
''
}}
validationSchema
=
{
Yup
.
object
({
name
:
Yup
.
string
()
.
required
(
'
이름을 입력해주세요.
'
),
id
:
Yup
.
string
()
.
required
(
'
학번을 입력해주세요.
'
),
password
:
Yup
.
string
()
.
required
(
'
비밀번호를 입력해주세요.
'
)
.
min
(
8
,
'
8자 이상 입력해주세요.
'
),
password2
:
Yup
.
string
()
.
required
(
'
비밀번호를 다시 입력해주세요.
'
)
.
min
(
8
,
'
8자 이상 입력해주세요.
'
)
.
oneOf
([
Yup
.
ref
(
"
password
"
),
null
],
'
비밀번호가 일치하지 않습니다.
'
),
answer
:
Yup
.
string
()
.
required
(
'
답변을 입력해주세요.
'
),
})}
onSubmit
=
{(
values
,
{
setSubmitting
})
=>
{
axios
({
method
:
'
post
'
,
url
:
'
/users
'
,
data
:
values
,
}).
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
alert
(
"
회원가입이 완료되었습니다!
"
)
setState
(
true
);
})
.
catch
(
err
=>
{
alert
(
err
.
error
)
});
if
(
state
)
{
return
<
Redirect
to
=
"
/login
"
/>
;
}
return
(
<
div
className
=
"
vh-100
"
>
<
Menu
expand
=
"
md
"
variant
=
"
dark
"
>
<
Navbar
.
Brand
>
회원가입
<
/Navbar.Brand
>
<
/Menu
>
<
Container
fluid
>
<
Wow
className
=
"
row justify-content-center
"
>
<
Col
md
=
{
3
}
xs
=
{
11
}
className
=
"
p-0
"
>
<
Formik
initialValues
=
{{
name
:
''
,
id
:
''
,
password
:
''
,
password2
:
''
,
question
:
''
,
answer
:
''
}}
validationSchema
=
{
Yup
.
object
({
name
:
Yup
.
string
()
.
required
(
'
이름을 입력해주세요.
'
),
id
:
Yup
.
string
()
.
required
(
'
학번을 입력해주세요.
'
),
password
:
Yup
.
string
()
.
required
(
'
비밀번호를 입력해주세요.
'
)
.
min
(
8
,
'
8자 이상 입력해주세요.
'
),
password2
:
Yup
.
string
()
.
required
(
'
비밀번호를 다시 입력해주세요.
'
)
.
min
(
8
,
'
8자 이상 입력해주세요.
'
)
.
oneOf
([
Yup
.
ref
(
"
password
"
),
null
],
'
비밀번호가 일치하지 않습니다.
'
),
answer
:
Yup
.
string
()
.
required
(
'
답변을 입력해주세요.
'
),
})}
onSubmit
=
{(
values
,
{
setSubmitting
})
=>
{
axios
({
method
:
'
post
'
,
url
:
'
/
api/
users
'
,
data
:
values
,
}).
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
alert
(
"
회원가입이 완료되었습니다!
"
)
setState
(
true
);
})
.
catch
(
err
=>
{
alert
(
err
.
error
)
});
setTimeout
(()
=>
{
setSubmitting
(
false
);
},
400
);
// finish the cycle in handler
}}
>
{({
errors
,
touched
,
handleSubmit
,
getFieldProps
,
// contain values, handleChange, handleBlur
isSubmitting
,
})
=>
(
<
form
onSubmit
=
{
handleSubmit
}
className
=
"
d-flex flex-column pt-3
"
>
<
div
className
=
"
form-group
"
>
<
div
className
=
{
touched
.
name
&&
errors
.
name
?
"
text-danger
"
:
""
}
>
이름을
입력하세요
<
/div
>
<
input
className
=
{(
touched
.
name
&&
errors
.
name
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
text
"
name
=
"
name
"
{...
getFieldProps
(
'
name
'
)}
placeholder
=
"
이름
"
/>
<
/div
>
setTimeout
(()
=>
{
setSubmitting
(
false
);
},
400
);
// finish the cycle in handler
}}
>
{({
errors
,
touched
,
handleSubmit
,
getFieldProps
,
// contain values, handleChange, handleBlur
isSubmitting
,
})
=>
(
<
form
onSubmit
=
{
handleSubmit
}
className
=
"
d-flex flex-column pt-3
"
>
<
div
className
=
"
form-group
"
>
<
div
className
=
{
touched
.
name
&&
errors
.
name
?
"
text-danger
"
:
""
}
>
이름을
입력하세요
<
/div
>
<
input
className
=
{(
touched
.
name
&&
errors
.
name
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
text
"
name
=
"
name
"
{...
getFieldProps
(
'
name
'
)}
placeholder
=
"
이름
"
/>
<
/div
>
<
div
className
=
"
form-group
"
>
<
div
className
=
{
touched
.
id
&&
errors
.
id
?
"
text-danger
"
:
""
}
>
학번을
입력하세요
<
/div
>
<
input
className
=
{(
touched
.
id
&&
errors
.
id
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
text
"
name
=
"
id
"
{...
getFieldProps
(
'
id
'
)}
placeholder
=
"
학번/교번
"
/>
<
/div
>
<
div
className
=
"
form-group
"
>
<
div
className
=
{
touched
.
id
&&
errors
.
id
?
"
text-danger
"
:
""
}
>
학번을
입력하세요
<
/div
>
<
input
className
=
{(
touched
.
id
&&
errors
.
id
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
text
"
name
=
"
id
"
{...
getFieldProps
(
'
id
'
)}
placeholder
=
"
학번/교번
"
/>
<
/div
>
<
div
className
=
"
form-group
"
>
<
div
className
=
{
touched
.
password
&&
errors
.
password
?
"
text-danger
"
:
""
}
>
비밀번호를
입력하세요
(
8
자리
이상
)
<
/div
>
<
input
className
=
{(
touched
.
password
&&
errors
.
password
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
password
"
name
=
"
password
"
{...
getFieldProps
(
'
password
'
)}
placeholder
=
"
비밀번호
"
/>
<
/div
>
<
div
className
=
"
form-group
"
>
<
div
className
=
{
touched
.
password
&&
errors
.
password
?
"
text-danger
"
:
""
}
>
비밀번호를
입력하세요
(
8
자리
이상
)
<
/div
>
<
input
className
=
{(
touched
.
password
&&
errors
.
password
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
password
"
name
=
"
password
"
{...
getFieldProps
(
'
password
'
)}
placeholder
=
"
비밀번호
"
/>
<
/div
>
<
div
className
=
"
form-group
"
>
{
touched
.
password2
&&
errors
.
password2
?
setCheckPw
(
false
)
:
null
}
<
div
id
=
"
reCheck
"
className
=
{
checkPw
?
"
right
"
:
"
err
"
}
><
/div
>
<
input
className
=
{
touched
.
password2
&&
errors
.
password2
?
"
form-control is-invalid
"
:
"
form-control
"
}
type
=
"
password
"
name
=
"
password2
"
{...
getFieldProps
(
'
password2
'
)}
placeholder
=
"
비밀번호 확인
"
/>
<
/div
>
<
div
className
=
"
form-group
"
>
{
touched
.
password2
&&
errors
.
password2
?
setCheckPw
(
false
)
:
setCheckPw
(
true
)
}
<
div
id
=
"
reCheck
"
className
=
{
checkPw
?
"
right
"
:
"
err
"
}
><
/div
>
<
input
className
=
{
touched
.
password2
&&
errors
.
password2
?
"
form-control is-invalid
"
:
"
form-control
"
}
type
=
"
password
"
name
=
"
password2
"
{...
getFieldProps
(
'
password2
'
)}
placeholder
=
"
비밀번호 확인
"
/>
<
/div
>
<
div
className
=
"
form-group
"
>
<
label
>
본인
확인
질문
<
/label
>
<
Field
as
=
"
select
"
name
=
"
question
"
>
<
option
value
=
""
>
질문을
선택하세요
<
/option
>
<
option
value
=
"
life
"
>
자신의
인생
좌우명은
?
<
/option
>
<
option
value
=
"
school
"
>
자신이
다녔던
초등학교의
이름은
?
<
/option
>
<
option
value
=
"
place
"
>
기억에
남는
추억의
장소는
?
<
/option
>
<
/Field
>
<
/div
>
<
div
className
=
"
form-group
"
>
<
div
className
=
{
touched
.
answer
&&
errors
.
answer
?
"
text-danger
"
:
""
}
>
답변을
입력해주세요
.
<
/div
>
<
input
className
=
{(
touched
.
answer
&&
errors
.
answer
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
text
"
name
=
"
answer
"
{...
getFieldProps
(
'
answer
'
)}
placeholder
=
"
Input answer
"
/>
<
/div
>
<
Button
type
=
"
submit
"
variant
=
"
secondary
"
className
=
"
mb-2
"
disabled
=
{
isSubmitting
}
>
회원가입
<
/Button
>
<
Button
variant
=
"
outline-secondary
"
as
=
{
Link
}
to
=
"
/login
"
>
로그인하러
가기
<
/Button
>
<
/form
>
)}
<
/Formik
>
<
/Col
>
<
/Wow
>
<
/Container
>
<
/div
>
);
<
div
className
=
"
form-group
"
>
<
label
>
본인
확인
질문
<
/label
>
<
Field
as
=
"
select
"
name
=
"
question
"
>
<
option
value
=
""
>
질문을
선택하세요
<
/option
>
<
option
value
=
"
life
"
>
자신의
인생
좌우명은
?
<
/option
>
<
option
value
=
"
school
"
>
자신이
다녔던
초등학교의
이름은
?
<
/option
>
<
option
value
=
"
place
"
>
기억에
남는
추억의
장소는
?
<
/option
>
<
/Field
>
<
/div
>
<
div
className
=
"
form-group
"
>
<
div
className
=
{
touched
.
answer
&&
errors
.
answer
?
"
text-danger
"
:
""
}
>
답변을
입력해주세요
.
<
/div
>
<
input
className
=
{(
touched
.
answer
&&
errors
.
answer
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
text
"
name
=
"
answer
"
{...
getFieldProps
(
'
answer
'
)}
placeholder
=
"
Input answer
"
/>
<
/div
>
<
Button
type
=
"
submit
"
variant
=
"
secondary
"
className
=
"
mb-2
"
disabled
=
{
isSubmitting
}
>
회원가입
<
/Button
>
<
Button
variant
=
"
outline-secondary
"
as
=
{
Link
}
to
=
"
/login
"
>
로그인하러
가기
<
/Button
>
<
/form
>
)}
<
/Formik
>
<
/Col
>
<
/Wow
>
<
/Container
>
<
/div
>
);
}
export
default
Signup
\ No newline at end of file
client/src/Pages/WritePage.js
View file @
1e75d62c
...
...
@@ -22,7 +22,7 @@ function Write() {
}
function
acheck
()
{
axios
.
get
(
`/users/admin/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
axios
.
get
(
`/
api/
users/admin/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
...
...
@@ -56,7 +56,7 @@ function Write() {
console
.
log
(
values
)
axios
({
method
:
'
post
'
,
url
:
'
/writes
'
,
url
:
'
/
api/
writes
'
,
data
:
values
,
}).
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
...
...
server/express.js
View file @
1e75d62c
...
...
@@ -22,12 +22,12 @@ app.use(cors())
console
.
log
(
'
path=
'
,
path
.
join
(
CURRENT_WORKING_DIR
,
'
client
'
,
'
build
'
))
app
.
use
(
'
/
'
,
express
.
static
(
path
.
join
(
CURRENT_WORKING_DIR
,
'
client
'
,
'
build
'
)))
app
.
use
(
'
/
'
,
indexRouter
);
app
.
use
(
'
/users
'
,
usersRouter
,
reservesRouter
);
app
.
use
(
'
/login
'
,
loginRouter
);
app
.
use
(
'
/reserves
'
,
reservesRouter
);
app
.
use
(
'
/notices
'
,
noticeRouter
);
app
.
use
(
'
/writes
'
,
writesRouter
);
app
.
use
(
'
/
api/
'
,
indexRouter
);
app
.
use
(
'
/
api/
users
'
,
usersRouter
,
reservesRouter
);
app
.
use
(
'
/
api/
login
'
,
loginRouter
);
app
.
use
(
'
/
api/
reserves
'
,
reservesRouter
);
app
.
use
(
'
/
api/
notices
'
,
noticeRouter
);
app
.
use
(
'
/
api/
writes
'
,
writesRouter
);
app
.
use
((
err
,
req
,
res
,
next
)
=>
{
if
(
err
.
name
===
'
UnauthorizedError
'
)
{
...
...
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