Skip to content

Commit

Permalink
[PDW-67] feat: API 경로 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
psyeon1120 committed Nov 2, 2023
1 parent d0b41b1 commit 20d504f
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 21 deletions.
16 changes: 12 additions & 4 deletions src/api/AxiosApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ export const ResourcesAxios = axios.create({
baseURL: `${host}/resources`,
});

export const CarsAxios = axios.create({
baseURL: `${host}/cars`,
});

export const EquipmentsAxios = axios.create({
baseURL: `${host}/equipments`,
});

export const ArchivingssAxios = axios.create({
baseURL: `${host}/archivings`,
export const ArchivingAxios = axios.create({
baseURL: `${host}/archives`,
});

export const AdminUsersAxios = axios.create({
Expand All @@ -35,11 +39,15 @@ export const AdminBookingAxios = axios.create({
baseURL: `${host}/admin/bookings`,
});

export const AdminBookingResourceAxios = axios.create({
export const AdminCarsAxios = axios.create({
baseURL: `${host}/admin/cars`,
});

export const AdminResourcesAxios = axios.create({
baseURL: `${host}/admin/resources`,
});

export const AdminBookingOfficeAxios = axios.create({
export const AdminOfficesAxios = axios.create({
baseURL: `${host}/admin/offices`,
});

Expand Down
6 changes: 3 additions & 3 deletions src/pages/admin/office/OfficeBookingManageDetail.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { OfficesAxios, AdminBookingOfficeAxios } from 'api/AxiosApi';
import { OfficesAxios, AdminOfficesAxios } from 'api/AxiosApi';
import { useState, useEffect } from "react";
import { useParams } from 'react-router-dom';
import Capsule from 'components/capsule/Capsule';
Expand Down Expand Up @@ -35,7 +35,7 @@ function OfficeManageDetail() {
}

const getOfficeBookingListInfo = () => {
AdminBookingOfficeAxios.get(`offices/${officeId}`, {
AdminOfficesAxios.get(`offices/${officeId}`, {
headers: {
Authorization: getToken()
}
Expand All @@ -53,7 +53,7 @@ function OfficeManageDetail() {

const deleteResource = () => {
if (window.confirm("회의실을 삭제하시겠습니까?")) {
AdminBookingOfficeAxios.delete(`${officeId}`, {
AdminOfficesAxios.delete(`${officeId}`, {
headers: {
Authorization: getToken()
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/admin/office/OfficeManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import OfficeManageTableCell from "./OfficeManageTableCell";
import ManageSearchBar from "components/searchBar/ManageSearchBar";
import {getToken} from "utils/IsLoginUtil";
import {basicError} from "utils/ErrorHandlerUtil";
import {AdminBookingOfficeAxios} from "api/AxiosApi";
import {AdminOfficesAxios} from "api/AxiosApi";

function OfficeManage(props) {

const [offices, setOffices] = useState([]);

const getOffices = (name) => {
const max = Int32Array.max;
AdminBookingOfficeAxios.get(`?facilityName=${name}&size=200`,{
AdminOfficesAxios.get(`?facilityName=${name}&size=200`,{
headers: {
Authorization: getToken()
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/admin/office/OfficeManageTableCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React from 'react';
import {Link} from 'react-router-dom';
import {BookedLineTr} from '../../basic/myBookings/BookedList';
import {Toggle} from "../../../components/toggle/Toggle";
import {AdminBookingOfficeAxios} from "../../../api/AxiosApi";
import {AdminOfficesAxios} from "../../../api/AxiosApi";
import {getToken} from "../../../utils/IsLoginUtil";
import {basicError} from "../../../utils/ErrorHandlerUtil";

function OfficeManageTableCell(props) {

const changeToggle = (isEnable) => {
AdminBookingOfficeAxios.patch(`/${props.id}/activation`, null, {
AdminOfficesAxios.patch(`/${props.id}/activation`, null, {
headers: {
Authorization: getToken()
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/admin/resource/ResourceManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ResourceManageTableCell from "./ResourceManageTableCell";
import ManageSearchBar from "components/searchBar/ManageSearchBar";
import { getToken } from "utils/IsLoginUtil";
import { basicError } from "utils/ErrorHandlerUtil";
import { AdminBookingResourceAxios } from "api/AxiosApi";
import { AdminResourcesAxios } from "api/AxiosApi";


function ResourceManage(props) {
Expand All @@ -15,7 +15,7 @@ function ResourceManage(props) {

const getResources = (name) => {
const max = Int32Array.max;
AdminBookingResourceAxios.get(`?keyword=${name}&size=200`, {
AdminResourcesAxios.get(`?keyword=${name}&size=200`, {
headers: {
Authorization: getToken()
}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/admin/resource/ResourceManageAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ManageAddButton, ManageAddButtonImage, ManageAddButtonLabel } from "com

import { getToken } from "utils/IsLoginUtil";
import { basicError } from "utils/ErrorHandlerUtil";
import {AdminBookingResourceAxios, ImageUrlAxios, ResourcesAxios, UsersAxios} from "api/AxiosApi";
import {AdminResourcesAxios, ImageUrlAxios, ResourcesAxios, UsersAxios} from "api/AxiosApi";

import AddImageImage from "../../../assets/images/AddImage.svg"
import SearchButtonImage from "../../../assets/images/SearchPlus.svg"
Expand Down Expand Up @@ -299,7 +299,7 @@ function ResourceManageAdd(props) {
}

const addResource = () => {
AdminBookingResourceAxios.post(``, {
AdminResourcesAxios.post(``, {
responsibility: staff.userId,
description: description,
location: place,
Expand All @@ -323,7 +323,7 @@ function ResourceManageAdd(props) {
const editResource = () => {


AdminBookingResourceAxios.patch(`/${resourceId}`, {
AdminResourcesAxios.patch(`/${resourceId}`, {
responsibility: staff.userId,
description: description,
location: place,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/admin/resource/ResourceManageDetail.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import styled from "styled-components"
import { ResourcesAxios, AdminBookingResourceAxios } from 'api/AxiosApi';
import { ResourcesAxios, AdminResourcesAxios } from 'api/AxiosApi';
import { useState, useEffect } from "react";
import { useParams } from 'react-router-dom';
import Capsule from 'components/capsule/Capsule';
Expand Down Expand Up @@ -79,7 +79,7 @@ function ResourceManageDetail() {
}

const getResourceBookingListInfo = () => {
AdminBookingResourceAxios.get(`${resourceId}`, {
AdminResourcesAxios.get(`${resourceId}`, {
headers: {
Authorization: getToken()
}
Expand All @@ -97,7 +97,7 @@ function ResourceManageDetail() {

const deleteResource = () => {
if (window.confirm("장비을 삭제하시겠습니까?")) {
AdminBookingResourceAxios.delete(`${resourceId}`, {
AdminResourcesAxios.delete(`${resourceId}`, {
headers: {
Authorization: getToken()
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/admin/resource/ResourceManageTableCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React from 'react';
import { BookedLineTr } from '../../basic/myBookings/BookedList';
import {Toggle} from "../../../components/toggle/Toggle";
import {Link} from "react-router-dom";
import {AdminBookingResourceAxios} from "../../../api/AxiosApi";
import {AdminResourcesAxios} from "../../../api/AxiosApi";
import {getToken} from "../../../utils/IsLoginUtil";
import {basicError} from "../../../utils/ErrorHandlerUtil";

function ResourceManageTableCell(props) {

const changeToggle = (isEnable) => {
AdminBookingResourceAxios.patch(`/${props.id}/activation`, null, {
AdminResourcesAxios.patch(`/${props.id}/activation`, null, {
headers: {
Authorization: getToken()
}
Expand Down

0 comments on commit 20d504f

Please sign in to comment.