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
7bca1c48
Commit
7bca1c48
authored
Oct 09, 2020
by
CHAERIN KIM
Browse files
확인페이지 기능 완성
parent
1a1b300b
Changes
2
Show whitespace changes
Inline
Side-by-side
server/client/src/Pages/ApplyPage.js
View file @
7bca1c48
...
@@ -46,7 +46,7 @@ function Apply() {
...
@@ -46,7 +46,7 @@ function Apply() {
<
div
className
=
"
row justify-content-center align-items-center
"
>
<
div
className
=
"
row justify-content-center align-items-center
"
>
<
form
onSubmit
=
{
handleSubmit
}
className
=
"
col-sm-3
"
>
<
form
onSubmit
=
{
handleSubmit
}
className
=
"
col-sm-3
"
>
<
button
type
=
"
submit
"
className
=
"
btn btn-dark
"
disabled
=
{
isSubmitting
}
>
<
button
type
=
"
submit
"
className
=
"
btn btn-dark
"
disabled
=
{
isSubmitting
}
>
Sign
Up
신청
<
/button
>
<
/button
>
<
/form
>
<
/form
>
<
/div
>
<
/div
>
...
...
server/client/src/Pages/CheckPage.js
View file @
7bca1c48
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
Menu
from
'
../Components/Menu
'
;
import
Menu
from
'
../Components/Menu
'
;
import
List
from
'
../Components/List
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
function
Check
(
props
)
{
function
Check
(
props
)
{
...
@@ -19,6 +18,45 @@ function Check(props) {
...
@@ -19,6 +18,45 @@ function Check(props) {
alert
(
err
.
error
)
alert
(
err
.
error
)
});
});
}
}
function
remove
(
index
)
{
axios
.
delete
(
`/reserves/
${
reserve
[
index
].
_id
}
`
)
.
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
alert
(
"
삭제되었습니다!
"
)
})
.
catch
(
err
=>
{
alert
(
err
.
error
)
});
};
function
renderTableBody
()
{
return
reserve
.
map
((
reserve
,
index
)
=>
{
return
(
<
tr
key
=
{
index
}
>
<
td
>
{
props
.
match
.
params
.
id
}
<
/td
>
<
td
>
{
reserve
.
name
}
<
/td
>
<
td
>
{
reserve
.
date
}
<
/td
>
<
td
>
{
reserve
.
room
}
<
/td
>
<
td
>
<
button
onClick
=
{()
=>
remove
(
index
)}
className
=
"
btn btn-dark
"
>
취소
<
/button
>
<
/td
>
<
/tr
>
)
})
}
function
renderTableHeader
(
props
)
{
return
(
<
tr
>
<
th
>
아이디
<
/th
>
<
th
>
이름
<
/th
>
<
th
>
날짜
<
/th
>
<
th
>
강의실
<
/th
>
<
th
>
예약취소
<
/th
>
<
/tr
>
)
}
const
[
reserve
,
setReserve
]
=
useState
([]);
const
[
reserve
,
setReserve
]
=
useState
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -27,10 +65,11 @@ function Check(props) {
...
@@ -27,10 +65,11 @@ function Check(props) {
return
(
return
(
<
div
>
<
div
>
<
Menu
/>
<
Menu
/>
<
div
className
=
"
container
"
>
check
<
div
className
=
""
>
check
{
reserve
.
map
((
reserve
,
index
)
=>
<
tbody
>
<
List
id
=
{
props
.
match
.
params
.
id
}
index
=
{
index
}
date
=
{
reserve
.
date
}
name
=
{
reserve
.
name
}
room
=
{
reserve
.
room
}
time
=
{
reserve
.
time
}
num
=
{
reserve
.
num
}
_id
=
{
reserve
.
_id
}
/
>
{
renderTableHeader
()}
)}
{
renderTableBody
()}
<
/tbody
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)
)
...
...
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