Skip to content

Commit

Permalink
[PDW-67] fix: 전체 API 토큰 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
psyeon1120 committed Nov 2, 2023
1 parent 20d504f commit 5a3ce4e
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 115 deletions.
50 changes: 35 additions & 15 deletions src/pages/basic/booking/office/OfficeBooking.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
import React from 'react';
import React, {useEffect, useState} from 'react';
import styled from "styled-components"
import { OfficesAxios, BookingsAxios } from 'api/AxiosApi';
import { useState, useEffect } from "react";
import { useParams } from 'react-router-dom';
import {OfficesAxios} from 'api/AxiosApi';
import {useParams} from 'react-router-dom';
import Capsule from 'components/capsule/Capsule';

import OfficeInfo from "components/officeInfo/OfficeInfo";
import { MainTextContainer, SubTextContainer, SelectedSubTitleText, UnselectedSubTitleText } from 'components/officeBooking/SubTitleBar';
import { DatePicker } from 'components/searchBar/SearchBar';
import {
BookingContentContainer, BookingTimeContainer, renderBookingTimeBar, BookingDateTextContainer, setBookingState, RequestButtonContainer, requestBookingOffice
MainTextContainer,
SelectedSubTitleText,
SubTextContainer,
UnselectedSubTitleText
} from 'components/officeBooking/SubTitleBar';
import {DatePicker} from 'components/searchBar/SearchBar';
import {
BookingContentContainer,
BookingDateTextContainer,
BookingTimeContainer,
renderBookingTimeBar,
RequestButtonContainer,
setBookingState
} from 'components/officeBooking/BookingTimeBar';
import { BookingPurposeContainer, BookingCapsuleContainer, BookingPurposeTextFieldContainer } from 'components/officeBooking/BookingPurpose';
import { RightContainer, WhiteContainer, TitleText } from 'components/rightContainer/RightContainer';
import { basicError } from 'utils/ErrorHandlerUtil';
import {
BookingCapsuleContainer,
BookingPurposeContainer,
BookingPurposeTextFieldContainer
} from 'components/officeBooking/BookingPurpose';
import {RightContainer, TitleText, WhiteContainer} from 'components/rightContainer/RightContainer';
import {basicError} from 'utils/ErrorHandlerUtil';
import SmallButton from 'components/button/SmallButton';
import { Bar } from '../../myBookings/BookedList';
import { getToken } from 'utils/IsLoginUtil';
import {Bar} from '../../myBookings/BookedList';
import {getToken} from 'utils/IsLoginUtil';
import moment from 'moment';

var bookingDate = '';
Expand Down Expand Up @@ -51,7 +64,6 @@ export const PurposeTextarea = styled.textarea`
margin: 0 10px 0 10px;
`


function OfficeBooking(props) {
let { officeId } = useParams();

Expand All @@ -74,7 +86,11 @@ function OfficeBooking(props) {

// 일자별 예약 현황 받아오기
const getBookingTimeState = () => {
OfficesAxios.get(`/${officeId}/booking-state?date=${bookingDate}`)
OfficesAxios.get(`/${officeId}/booking-state?date=${bookingDate}`, {
headers: {
Authorization: getToken()
}
})
.then((Response) => {
setBookingDetail(Response.data.data.bookedTimes)
setBookingState(Response.data.data.bookedTimes)
Expand All @@ -89,7 +105,11 @@ function OfficeBooking(props) {

// 회의실 정보 받아오기
const getOfficeInfoForBooking = (id) => {
OfficesAxios.get(`/${officeId}`)
OfficesAxios.get(`/${officeId}`, {
headers: {
Authorization: getToken()
}
})
.then((Response) => {
setOfficeInfo(Response.data.data)
})
Expand Down
12 changes: 10 additions & 2 deletions src/pages/basic/booking/office/OfficeBookingCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ function OfficeBookingCheck(props) {
Authorization: getToken()
}
})
: BookingsAxios.get(`/offices/${bookingId}`))
: BookingsAxios.get(`/offices/${bookingId}`, {
headers: {
Authorization: getToken()
}
}))
.then((Response) => {
setBookingDetail(Response.data.data)
setStatus(findStatus(Response.data.data.bookingStatus))
Expand All @@ -57,7 +61,11 @@ function OfficeBookingCheck(props) {
};

const getOfficeInfo = () => {
OfficesAxios.get(`/${officeId}`)
OfficesAxios.get(`/${officeId}`, {
headers: {
Authorization: getToken()
}
})
.then((Response) => {
setOfficeInfo(Response.data.data)
})
Expand Down
Loading

0 comments on commit 5a3ce4e

Please sign in to comment.