Commit 9cc867e8 authored by CHAERIN KIM's avatar CHAERIN KIM
Browse files

승인 미승인

parent f3752c81
......@@ -30,10 +30,19 @@ function ACheck(props) {
if (state) return <Redirect to="/home" />;
function remove(index) {
axios.delete(`/reserves/${reserve[index]._id}`)
// axios.delete(`/reserves/${reserve[index]._id}`)
// .then(res => {
// if (res.status === 404) return alert(res.data.error)
// alert("삭제되었습니다!");
// getReserve();
// })
// .catch(err => {
// alert(err.error)
// });
axios.put(`/reserves/${reserve[index]._id}`)
.then(res => {
if (res.status === 404) return alert(res.data.error)
alert("삭제되었습니다!");
alert("승인을 거절했습니다!");
getReserve();
})
.catch(err => {
......@@ -42,7 +51,9 @@ function ACheck(props) {
};
function admit(index) {
axios.put(`/reserves/${reserve[index]._id}`)
axios.put(`/reserves/${reserve[index]._id}`, {
approve: true,
})
.then(res => {
if (res.status === 404) return alert(res.data.error)
alert("승인되었습니다!");
......@@ -69,12 +80,13 @@ function ACheck(props) {
</tr>
</thead>
<tbody>
{reserve.map((reserve, index) => {
{reserve != "" ? (
reserve.map((reserve, index) => {
return (
<tr key={index}>
<td>{reserve.user.name}</td>
<td>{reserve.date}</td>
<td>{reserve.time}</td>
<td>{reserve.starttime}~{(Number(reserve.starttime) + reserve.usetime)}</td>
<td>{reserve.room}</td>
<td>{reserve.num}</td>
<td>
......@@ -87,7 +99,7 @@ function ACheck(props) {
</td>
</tr>
)
})}
})) : <div>최근 대관 신청 내역이 없습니다.</div>}
</tbody>
</table>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment