diff --git a/src/pages/manager/officeManage/OfficeManage.js b/src/pages/manager/officeManage/OfficeManage.js index 4d4f3df..2b51f47 100644 --- a/src/pages/manager/officeManage/OfficeManage.js +++ b/src/pages/manager/officeManage/OfficeManage.js @@ -1,19 +1,45 @@ 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 OfficeManageTableCell from "./OfficeManageTableCell"; import ManageSearchBar from "components/searchBar/ManageSearchBar"; - +import { getToken } from "utils/IsLoginUtil"; +import { basicError } from "utils/ErrorHandlerUtil"; +import { OfficesAxios } from "api/AxiosApi"; function OfficeManage(props) { + const [offices, setOffices] = useState([]); + + const getOffices = (name) => { + const max = Int32Array.max; + OfficesAxios.get(`?keyword=${name}&size=200`,{ + headers: { + Authorization: getToken() + } + }) + .then((Response) => { setOffices(Response.data.data.content) }) + .catch((error) => {basicError(error)}) + }; + + const getSearchOffices = (e) => { + getOffices(e.target.value) + }; + + useEffect(() => { + getOffices(); + }, []) + + const moveToAdd = () => { + window.location.href = `/manage/offices/add` + } + return ( {props.title} - + @@ -28,7 +54,19 @@ function OfficeManage(props) { - + { offices.length === 0 ? + + 회의실 내역이 없습니다. + + : offices.map((office) => + + )}