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

승인 미승인

parent f3752c81
...@@ -30,10 +30,19 @@ function ACheck(props) { ...@@ -30,10 +30,19 @@ function ACheck(props) {
if (state) return <Redirect to="/home" />; if (state) return <Redirect to="/home" />;
function remove(index) { 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 => { .then(res => {
if (res.status === 404) return alert(res.data.error) if (res.status === 404) return alert(res.data.error)
alert("삭제되었습니다!"); alert("승인을 거절했습니다!");
getReserve(); getReserve();
}) })
.catch(err => { .catch(err => {
...@@ -42,7 +51,9 @@ function ACheck(props) { ...@@ -42,7 +51,9 @@ function ACheck(props) {
}; };
function admit(index) { function admit(index) {
axios.put(`/reserves/${reserve[index]._id}`) axios.put(`/reserves/${reserve[index]._id}`, {
approve: true,
})
.then(res => { .then(res => {
if (res.status === 404) return alert(res.data.error) if (res.status === 404) return alert(res.data.error)
alert("승인되었습니다!"); alert("승인되었습니다!");
...@@ -69,12 +80,13 @@ function ACheck(props) { ...@@ -69,12 +80,13 @@ function ACheck(props) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{reserve.map((reserve, index) => { {reserve != "" ? (
reserve.map((reserve, index) => {
return ( return (
<tr key={index}> <tr key={index}>
<td>{reserve.user.name}</td> <td>{reserve.user.name}</td>
<td>{reserve.date}</td> <td>{reserve.date}</td>
<td>{reserve.time}</td> <td>{reserve.starttime}~{(Number(reserve.starttime) + reserve.usetime)}</td>
<td>{reserve.room}</td> <td>{reserve.room}</td>
<td>{reserve.num}</td> <td>{reserve.num}</td>
<td> <td>
...@@ -87,7 +99,7 @@ function ACheck(props) { ...@@ -87,7 +99,7 @@ function ACheck(props) {
</td> </td>
</tr> </tr>
) )
})} })) : <div>최근 대관 신청 내역이 없습니다.</div>}
</tbody> </tbody>
</table> </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