diff --git a/src/pages/manager/resourceManage/ResourceManage.js b/src/pages/manager/resourceManage/ResourceManage.js index 2b482ab..81c78d4 100644 --- a/src/pages/manager/resourceManage/ResourceManage.js +++ b/src/pages/manager/resourceManage/ResourceManage.js @@ -1,19 +1,41 @@ import React from "react"; import { useState, useEffect } from "react"; -import axios from "axios"; import { RightContainer, TitleText, WhiteContainer } from "components/rightContainer/RightContainer"; import { Bar, BookedTable, BookedThead, TableContainer } from "../../booking/bookedList/BookedList"; import ResourceManageTableCell from "./ResourceManageTableCell"; import ManageSearchBar from "components/searchBar/ManageSearchBar"; +import { getToken } from "utils/IsLoginUtil"; +import { basicError } from "utils/ErrorHandlerUtil"; +import { AdminBookingResourceAxios } from "api/AxiosApi"; function ResourceManage(props) { + const [resources, setResources] = useState([]); + + const getResources = (name) => { + AdminBookingResourceAxios.get(`?keyword=${name}`, { + headers: { + Authorization: getToken() + } + }) + .then((Response) => { setResources(Response.data.data.content) }) + .catch((error) => {basicError(error)}) + }; + + const getSearchResources = (e) => { + getResources(e.target.value) + }; + + useEffect(() => { + getResources(""); + }, []) + return ( {props.title} - + @@ -27,7 +49,13 @@ function ResourceManage(props) { - + { resources.length === 0 ? + + 자원 내역이 없습니다. + + : resources.map((resource) => + + )} diff --git a/src/pages/manager/resourceManage/ResourceManageTableCell.js b/src/pages/manager/resourceManage/ResourceManageTableCell.js index e3d01cf..cb02379 100644 --- a/src/pages/manager/resourceManage/ResourceManageTableCell.js +++ b/src/pages/manager/resourceManage/ResourceManageTableCell.js @@ -1,5 +1,4 @@ import React from 'react'; -import { Link } from 'react-router-dom'; import { BookedLineTr } from '../../booking/bookedList/BookedList';