Skip to content

Commit

Permalink
Merge pull request #68 from PLADI-ALM/feat/PDW-54-manager-resource-2
Browse files Browse the repository at this point in the history
[PDW-54/Fix] 에러처리
  • Loading branch information
psyeon1120 authored Oct 11, 2023
2 parents 294e406 + 6f48b3f commit 78a0bf1
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/pages/booking/selectOffice/SelectOffice.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import OfficeInfo from "components/officeInfo/OfficeInfo";
import { RightContainer, WhiteContainer, TitleText } from "components/rightContainer/RightContainer";
import { OfficesAxios } from "api/AxiosApi";
import { useState } from "react";
import { basicError } from 'utils/ErrorHandlerUtil';

function SelectOffice(props) {

Expand All @@ -15,7 +16,7 @@ function SelectOffice(props) {
const getOfficeList = () => {
OfficesAxios.get()
.then((Response) => { setOffices(Response.data.data.content) })
.catch((Error) => { alert(Error) })
.catch((error) => {basicError(error)})
};


Expand All @@ -34,7 +35,7 @@ function SelectOffice(props) {
const searchOffice = () => {
OfficesAxios.get(`?date=${date}&startTime=${startTime}&endTime=${endTime}`)
.then((Response) => { setOffices(Response.data.data.content) })
.catch((Error) => { alert(Error.response.data.message) })
.catch((error) => {basicError(error)})
}

useEffect(() => {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/booking/selectResource/SelectResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import styled from "styled-components";
import ResourceInfo from "components/resourceInfo/ResourceInfo";
import { ResourcesAxios } from "api/AxiosApi";
import { useNavigate } from "react-router-dom";
import { basicError } from 'utils/ErrorHandlerUtil';


export const SearchTitleContainer = styled.div`
Expand Down Expand Up @@ -72,7 +73,7 @@ function SelectResource(props) {
const getResourceList = () => {
ResourcesAxios.get()
.then((Response) => { setResourceList(Response.data.data.content) })
.catch((Error) => { alert(Error) })
.catch((error) => {basicError(error)})
};


Expand All @@ -95,7 +96,7 @@ function SelectResource(props) {
const searchResource = () => {
ResourcesAxios.get(`?resourceName=${resourceName}&startDate=${startDate}&endDate=${endDate}`)
.then((Response) => { setResourceList(Response.data.data.content) })
.catch((Error) => { alert(Error.response.data.message) })
.catch((error) => {basicError(error)})
}


Expand Down
3 changes: 2 additions & 1 deletion src/pages/manager/officeBookingManage/OfficeBookingManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { AdminBookingAxios } from "api/AxiosApi";
import styled from "styled-components";
import RangeImage from "../../../assets/images/RangeArrow.svg"
import { getToken } from "utils/IsLoginUtil";
import { basicError } from 'utils/ErrorHandlerUtil';


const RangeImg = styled.img`
Expand All @@ -31,7 +32,7 @@ function OfficeBookingManage(props) {
}
})
.then((Response) => { SetBookingOffices(Response.data.data.content) })
.catch((Error) => { alert(Error.response.data.message) })
.catch((error) => {basicError(error)})
}

const chnageRange = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { USING, findStatus, BOOKED } from 'constants/BookingStatus';
import { AdminBookingAxios } from 'api/AxiosApi';
import styled from 'styled-components';
import { getToken } from 'utils/IsLoginUtil';
import { Link } from 'react-router-dom';
import { basicError } from 'utils/ErrorHandlerUtil';

const SettingButtonContainer = styled.div`
display: flex;
Expand Down Expand Up @@ -41,7 +41,7 @@ function OfficeBookingManageCell(props) {
alert(Response.data.message)
window.location.reload()
})
.catch((Error) => { alert(Error.response.data.message) })
.catch((error) => {basicError(error)})
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ManageSearchBar from "components/searchBar/ManageSearchBar";
import ResourceBookingManageCell from "./ResourceBookingManageCell";
import { AdminBookingAxios } from "api/AxiosApi";
import { getToken } from "utils/IsLoginUtil";
import { basicError } from "utils/ErrorHandlerUtil";


function ResourceBookingManage(props) {
Expand All @@ -24,7 +25,7 @@ function ResourceBookingManage(props) {
}
})
.then((Response) => { SetBookingResources(Response.data.data.content) })
.catch((Error) => { alert (Error.response.data.message) })
.catch((error) => {basicError(error)})
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { CANCELED, USING, WAITING, findStatus } from 'constants/BookingStatus';
import { AdminBookingAxios } from 'api/AxiosApi';
import styled from 'styled-components';
import { getToken } from 'utils/IsLoginUtil';
import { basicError } from 'utils/ErrorHandlerUtil';

const SettingButtonContainer = styled.div`
display: flex;
Expand Down Expand Up @@ -40,7 +41,7 @@ function ResourceBookingManageCell(props) {
alert(Response.data.message)
window.location.reload()
})
.catch((Error) => { alert(Error.response.data.message) })
.catch((error) => {basicError(error)})

props.refresh()
}
Expand All @@ -64,7 +65,7 @@ function ResourceBookingManageCell(props) {
alert(Response.data.message)
window.location.reload()
})
.catch((Error) => { alert(Error.response.data.message) })
.catch((error) => {basicError(error)})

props.refresh()
}
Expand All @@ -86,7 +87,7 @@ function ResourceBookingManageCell(props) {
alert(Response.data.message)
window.location.reload()
})
.catch((Error) => { alert(Error.response.data.message) })
.catch((error) => {basicError(error)})

props.refresh()
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ErrorHandlerUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ export function basicError(error) {
} catch (error) {
console.log(error)
}
}
}

0 comments on commit 78a0bf1

Please sign in to comment.