Skip to content

Commit

Permalink
[PDW-66] fix: 회의실 목록 조회 토큰 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
psyeon1120 committed Nov 1, 2023
1 parent 11d54c1 commit bcd6a2b
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions src/pages/booking/selectOffice/SelectOffice.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React, { useEffect } from "react";
import React, {useEffect} from "react";
import SearchBar from "components/searchBar/SearchBar";
import OfficeInfo from "components/officeInfo/OfficeInfo";
import {RightContainer, WhiteContainer, TitleText, ResourceSearchBar} from "components/rightContainer/RightContainer";
import { OfficesAxios } from "api/AxiosApi";
import { useState } from "react";
import { basicError } from 'utils/ErrorHandlerUtil';
import { SearchDateContainer, SearchDateInput, SearchTextInput, SearchTitleContainer, SearchTitleText} from "../selectResource/SelectResource";
import {OfficesAxios} from "api/AxiosApi";
import {useState} from "react";
import {basicError} from 'utils/ErrorHandlerUtil';
import {
SearchDateContainer,
SearchDateInput,
SearchTextInput,
SearchTitleContainer,
SearchTitleText
} from "../selectResource/SelectResource";
import SearchButtonImg from "../../../assets/images/button/searchButton.png";
import ImageButton from "../../../components/button/ImageButton";
import {SelectToggle} from "../../../components/capsule/SelectToggle";
Expand All @@ -23,13 +29,17 @@ function SelectOffice(props) {
const [endTime, setEndTime] = useState("");

const getOfficeList = () => {
OfficesAxios.get("?size=200", {
OfficesAxios.get("?size=200", {
headers: {
Authorization: getToken()
}
})
.then((Response) => { setOffices(Response.data.data.content) })
.catch((error) => {basicError(error)})
.then((Response) => {
setOffices(Response.data.data.content)
})
.catch((error) => {
basicError(error)
})
};

const changeFacilityName = (e) => {
Expand All @@ -49,9 +59,17 @@ function SelectOffice(props) {
}

const searchOffice = () => {
OfficesAxios.get(`?date=${date}&startTime=${startTime}&endTime=${endTime}&facilityName=${facilityName}`)
.then((Response) => { setOffices(Response.data.data.content) })
.catch((error) => {basicError(error)})
OfficesAxios.get(`?date=${date}&startTime=${startTime}&endTime=${endTime}&facilityName=${facilityName}`, {
headers: {
Authorization: getToken()
}
})
.then((Response) => {
setOffices(Response.data.data.content)
})
.catch((error) => {
basicError(error)
})
}

useEffect(() => {
Expand All @@ -67,18 +85,19 @@ function SelectOffice(props) {
<SearchTitleText>예약 가능 회의실 검색</SearchTitleText>
</SearchTitleContainer>

<SearchTextInput type="text" placeholder="시설 검색" onChange={changeFacilityName} />
<SearchTextInput type="text" placeholder="시설 검색" onChange={changeFacilityName}/>

<SearchDateContainer>
<SearchDateInput type="date" onChange={changeDate} />
<SelectToggle items={timeOptionList} change={changeStart} />~
<SelectToggle items={timeOptionList} change={changeEnd} />
<SearchDateInput type="date" onChange={changeDate}/>
<SelectToggle items={timeOptionList} change={changeStart}/>~
<SelectToggle items={timeOptionList} change={changeEnd}/>
</SearchDateContainer>
<ImageButton image={SearchButtonImg} width={"40px"} height={"40px"} click={searchOffice} />
<ImageButton image={SearchButtonImg} width={"40px"} height={"40px"} click={searchOffice}/>
</ResourceSearchBar>
<WhiteContainer>
<div className="cardList">
{offices.length === 0 ? <label>예약 가능한 회의실이 없습니다.</label> : offices.map((office) => <OfficeInfo key={office.officeId}
{offices.length === 0 ? <label>예약 가능한 회의실이 없습니다.</label> : offices.map((office) => <OfficeInfo
key={office.officeId}
officeId={office.officeId}
name={office.name}
imgUrl={office.imgUrl}
Expand Down

0 comments on commit bcd6a2b

Please sign in to comment.