From b8230c8d6681e1ad90224af3c5e36cab8fd752e7 Mon Sep 17 00:00:00 2001 From: ryr0121 Date: Wed, 25 Oct 2023 16:06:05 +0900 Subject: [PATCH] =?UTF-8?q?[PDW-40]=20feat:=20=ED=9A=8C=EC=9D=98=EC=8B=A4?= =?UTF-8?q?=20=EB=AA=A9=EB=A1=9D=20API=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/officeManage/OfficeManage.js | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) 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) => + + )}