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
0af3e43b
Commit
0af3e43b
authored
Oct 09, 2020
by
Choi Ga Young
Browse files
checkPage기능
parent
82e694e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/client/src/Pages/CheckPage.js
View file @
0af3e43b
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
Menu
from
'
../Components/Menu
'
;
import
List
from
'
../Components/List
'
;
import
axios
from
'
axios
'
;
import
'
bootstrap/dist/css/bootstrap.css
'
;
function
Check
(
props
)
{
function
getReserve
()
{
axios
.
get
(
`/reserves/
${
props
.
match
.
params
.
id
}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
...
...
@@ -19,21 +20,59 @@ function Check(props) {
alert
(
err
.
error
)
});
}
function
remove
(
index
)
{
axios
.
delete
(
`/reserves/
${
reserve
[
index
].
_id
}
`
)
.
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
alert
(
"
삭제되었습니다!
"
)
getReserve
();
})
.
catch
(
err
=>
{
alert
(
err
.
error
)
});
};
const
[
reserve
,
setReserve
]
=
useState
([]);
useEffect
(()
=>
{
getReserve
();
},
[])
return
(
<
div
>
<
Menu
/>
<
div
className
=
"
container
"
>
check
{
reserve
.
map
((
reserve
,
index
)
=>
<
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
}
/
>
)}
<
div
className
=
""
>
check
<
table
className
=
"
table
"
>
<
thead
>
<
tr
>
<
th
>
아이디
<
/th
>
<
th
>
이름
<
/th
>
<
th
>
날짜
<
/th
>
<
th
>
강의실
<
/th
>
<
th
>
예약취소
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
{
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-danger
"
>
취소
<
/button
>
<
/td
>
<
/tr
>
)
})}
<
/tbody
>
<
/table
>
<
/div
>
<
/div
>
)
}
export
default
Check
\ No newline at end of file
export
default
Check
server/client/src/index.js
View file @
0af3e43b
...
...
@@ -34,6 +34,7 @@ ReactDOM.render(
<
Redirect
path
=
"
/
"
to
=
"
/
"
/>
<
Redirect
path
=
"
/home
"
to
=
"
/
"
/>
<
Redirect
path
=
"
/change/:id
"
to
=
"
/change
"
/>
<
Redirect
path
=
"
/check/:id
"
to
=
"
/check
"
/>
<
/Switch
>
<
/Router>
,
document
.
getElementById
(
'
root
'
)
...
...
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