Skip to content

Commit

Permalink
[PDW-83] fix: 차량 정보 파라미터 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
psyeon1120 committed Nov 12, 2023
1 parent 66cc52d commit 10fc9c5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 36 deletions.
1 change: 1 addition & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function App() {
<Route path='/admin/resourceBooking/:bookingId' element={<ResourceBookingCheck isAdmin={true} />} />
<Route path='/admin/cars' element={<CarManage />} />
<Route path='/admin/carBooking' element={<CarBookingManage/>} />
<Route path='/admin/carBooking/:bookingId' element={<CarBookingCheck isAdmin={true} />} />
<Route path='/admin/users' element={<UserManage />} />
</Route>
</Routes>
Expand Down
23 changes: 10 additions & 13 deletions src/pages/basic/booking/car/CarBookingCheck.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect, useRef, useState} from 'react';
import {AdminBookingAxios, BookingsAxios, ResourcesAxios} from 'api/AxiosApi';
import React, {useEffect, useState} from 'react';
import {AdminBookingAxios, BookingsAxios, CarsAxios} from 'api/AxiosApi';
import {useParams} from 'react-router-dom';
import Capsule from 'components/capsule/Capsule';
import {DetailSubTitleText, NameSubTitleText} from 'components/officeBooking/SubTitleBar';
Expand All @@ -11,19 +11,18 @@ import {RightContainer, TitleText, WhiteContainer} from 'components/rightContain
import {BookingDateText} from './CarBooking';
import {getToken} from 'utils/IsLoginUtil';
import {basicError} from 'utils/ErrorHandlerUtil';
import {Bar} from '../../myBookings/BookedList';
import ResourceDetailInfo from "../../../../components/card/ResourceDetailInfo";
import {Bar} from 'pages/basic/myBookings/BookedList';
import ResourceDetailInfo from "components/card/ResourceDetailInfo";

function CarBookingCheck(props) {
let {bookingId} = useParams();

const [carInfo, setCarInfo] = useState([]);
const [bookingInfo, setBookingDetail] = useState([]);
const [bookingStatus, setStatus] = useState([]);
const carId = useRef("");

const getCarInfo = () => {
ResourcesAxios.get(`/${carId.current}`,
const getCarInfo = (carId) => {
CarsAxios.get(`/${carId}`,
{
headers: {
Authorization: getToken()
Expand All @@ -35,7 +34,7 @@ function CarBookingCheck(props) {
.catch((Error) => {
basicError(Error)
console.log(Error)
window.alert("장비 정보를 불러올 수 없습니댜.")
window.alert("차량 정보를 불러올 수 없습니댜.")
window.history.back()
});
};
Expand All @@ -55,8 +54,7 @@ function CarBookingCheck(props) {
.then((Response) => {
setBookingDetail(Response.data.data)
setStatus(findStatus(Response.data.data.status))
carId.current = Response.data.data.carId
getCarInfo(carId.current)
getCarInfo(Response.data.data.carId)
})
.catch((Error) => {
basicError(Error)
Expand All @@ -67,7 +65,6 @@ function CarBookingCheck(props) {
};

useEffect(() => {
getCarInfo();
getBookingInfo();
}, []);

Expand All @@ -77,8 +74,8 @@ function CarBookingCheck(props) {
<WhiteContainer>
<Bar space={true}>
<div>
<NameSubTitleText>{carInfo.name}</NameSubTitleText>
<DetailSubTitleText>{carInfo.category}</DetailSubTitleText>
<NameSubTitleText>{carInfo.name}{carInfo.manufacture}</NameSubTitleText>
<DetailSubTitleText>{carInfo.location}</DetailSubTitleText>
</div>
<StatusContainer style={{margin: '0'}} isCheck={'true'}
background={bookingStatus.background}>
Expand Down
33 changes: 10 additions & 23 deletions src/pages/basic/booking/resource/ResourceBookingCheck.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
import React, {useEffect, useRef, useState} from 'react';
import React, {useEffect, useState} from 'react';
import {AdminBookingAxios, BookingsAxios, ResourcesAxios} from 'api/AxiosApi';
import {useParams} from 'react-router-dom';
import Capsule from 'components/capsule/Capsule';
import {
MainTextContainer,
NameSubTitleText,
SubTextContainer,
DetailSubTitleText
} from 'components/officeBooking/SubTitleBar';
import {
BookingCapsuleContainer,
BookingPurposeContainer,
PurposeContainer
} from 'components/officeBooking/BookingPurpose';
import {DetailSubTitleText, NameSubTitleText} from 'components/officeBooking/SubTitleBar';
import {BookingPurposeContainer, PurposeContainer} from 'components/officeBooking/BookingPurpose';
import {BookingContentContainer} from 'components/officeBooking/BookingTimeBar';
import {StatusCircle, StatusContainer, StatusText} from 'components/booking/StatusTag';
import {findStatus} from 'constants/BookingStatus';
import {RightContainer, TitleText, WhiteContainer} from 'components/rightContainer/RightContainer';
import {BookingDateText} from './ResourceBooking';
import {getToken} from 'utils/IsLoginUtil';
import {basicError} from 'utils/ErrorHandlerUtil';
import {Bar} from '../../myBookings/BookedList';
import ResourceDetailInfo from "../../../../components/card/ResourceDetailInfo";
import {Bar} from 'pages/basic/myBookings/BookedList';
import ResourceDetailInfo from "components/card/ResourceDetailInfo";

function ResourceBookingCheck(props) {
let {bookingId} = useParams();

const [resourceInfo, setResourceInfo] = useState([]);
const [bookingInfo, setBookingDetail] = useState([]);
const [bookingStatus, setStatus] = useState([]);
const resourceId = useRef("");

const getResourceInfo = () => {
ResourcesAxios.get(`/${resourceId.current}`,
const getResourceInfo = (resourceId) => {
ResourcesAxios.get(`/${resourceId}`,
{
headers: {
Authorization: getToken()
Expand Down Expand Up @@ -64,8 +54,7 @@ function ResourceBookingCheck(props) {
.then((Response) => {
setBookingDetail(Response.data.data)
setStatus(findStatus(Response.data.data.status))
resourceId.current = Response.data.data.resourceId
getResourceInfo(resourceId.current)
getResourceInfo(Response.data.data.resourceId)
})
.catch((Error) => {
basicError(Error)
Expand All @@ -76,7 +65,6 @@ function ResourceBookingCheck(props) {
};

useEffect(() => {
getResourceInfo();
getBookingInfo();
}, []);

Expand All @@ -86,8 +74,8 @@ function ResourceBookingCheck(props) {
<WhiteContainer>
<Bar space={true}>
<div>
<NameSubTitleText>{resourceInfo.name}</NameSubTitleText>
<DetailSubTitleText>{resourceInfo.category}</DetailSubTitleText>
<NameSubTitleText>{resourceInfo.name}({resourceInfo.manufacture})</NameSubTitleText>
<DetailSubTitleText>{resourceInfo.location}</DetailSubTitleText>
</div>
<StatusContainer style={{margin: '0'}} isCheck={'true'}
background={bookingStatus.background}>
Expand Down Expand Up @@ -125,7 +113,6 @@ function ResourceBookingCheck(props) {
</PurposeContainer>
</BookingPurposeContainer>


</WhiteContainer>
</RightContainer>
}
Expand Down

0 comments on commit 10fc9c5

Please sign in to comment.