Skip to content

Commit

Permalink
Merge pull request #151 from PLADI-ALM/feat/PDW-19-equipment
Browse files Browse the repository at this point in the history
[PDW-32/fix] 회의실, 장비, 차량 추가 오류 수정
  • Loading branch information
psyeon1120 authored Nov 29, 2023
2 parents e8d7c08 + bf1c6c6 commit 6f70c04
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 32 deletions.
8 changes: 4 additions & 4 deletions src/components/sidebar/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ function useIsMenuActive(path) {
}

function logout() {
const token = getToken()
removeAllCookies()

UsersAxios.post("/logout", null, {
headers: {
Authorization: getToken()
Authorization: token
}
})
.then((response) => {
removeAllCookies()
navigateToLogin()
window.location.replace('/')
})
.catch((error) => {
basicError(error)
Expand Down Expand Up @@ -156,7 +157,6 @@ function Sidebar() {
{MAIN_MENUS[1].subMenus.map(sub => { return (<SubMenu path={sub.path} name={sub.name} />) })}
</SubMenus>
<MainMenu info={MAIN_MENUS[2]} active={useIsMenuActive(MAIN_MENUS[2].path)} />
<MainMenu info={MAIN_MENUS[3]} active={useIsMenuActive(MAIN_MENUS[3].path)} />

{/* 관리자 메뉴 */}
{isManager() ? managerMenus : null}
Expand Down
5 changes: 1 addition & 4 deletions src/constants/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import MyBookingActiveIcon from 'assets/images/sidebarIcon/MyBookingActive.svg'
import MyBookingInactiveIcon from 'assets/images/sidebarIcon/MyBookingInactive.svg'
import EquipmentActiveIcon from 'assets/images/sidebarIcon/EquipmentActive.svg'
import EquipmentInactiveIcon from 'assets/images/sidebarIcon/EquipmentInactive.svg'
import ArchivingActiveIcon from 'assets/images/sidebarIcon/ArchivingActive.svg'
import ArchivingInactiveIcon from 'assets/images/sidebarIcon/ArchivingInactive.svg'
import AdminActiveIcon from 'assets/images/sidebarIcon/AdminActive.svg'
import AdminInactiveIcon from 'assets/images/sidebarIcon/AdminInactive.svg'

Expand All @@ -29,8 +27,7 @@ export const MAIN_MENUS = [
subMenus: MY_BOOKING_MENUS,
icons: [MyBookingActiveIcon, MyBookingInactiveIcon]
},
{name: '비품 내역', path: '/equipments', subMenus: null, icons: [EquipmentActiveIcon, EquipmentInactiveIcon]},
{name: '자료 아카이빙', path: '/archiving', subMenus: null, icons: [ArchivingActiveIcon, ArchivingInactiveIcon]}
{name: '비품 내역', path: '/equipments', subMenus: null, icons: [EquipmentActiveIcon, EquipmentInactiveIcon]}
]

export const ADMIN_MENUS = [
Expand Down
15 changes: 7 additions & 8 deletions src/pages/admin/car/CarManageAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function CarManageAdd(props) {
description: null,
};
const [inputValues, setInputValues] = useState(initialValue);
const {name, capacity, place, description} = inputValues; //비구조화 할당
const {name, manufacturer, place, description} = inputValues; //비구조화 할당
const [staff, setStaff] = useState({
userId: null,
name: ""
Expand Down Expand Up @@ -213,7 +213,7 @@ function CarManageAdd(props) {
// 이미지 람다 호출
const getImageUrl = () => {
// todo: 검사 다 하기
if (staff.facilityId === null) {
if (staff.userId === null) {
alert("책임자를 선택해주세요.");
return;
}
Expand Down Expand Up @@ -264,9 +264,9 @@ function CarManageAdd(props) {

const addCar = () => {
AdminCarsAxios.post(``, {
responsibility: staff.facilityId,
responsibility: staff.userId,
description: description,
manufacturer: capacity,
manufacturer: manufacturer,
location: place,
name: name,
imgKey: imageFile === null ? null : `car/${imageUrl.imageKey}`,
Expand All @@ -287,9 +287,9 @@ function CarManageAdd(props) {

const editCar = () => {
AdminCarsAxios.patch(`/${carId}`, {
responsibility: staff.facilityId,
responsibility: staff.userId,
description: description,
manufacturer: capacity,
manufacturer: manufacturer,
location: place,
name: name,
imgKey: imageFile === null ? getImgKey(imageUrl) : `car/${imageUrl.imageKey}`,
Expand Down Expand Up @@ -334,7 +334,6 @@ function CarManageAdd(props) {
})
.catch((Error) => {
basicError(Error)
window.alert("차량 정보를 불러올 수 없습니댜.")
window.history.back()
})
}
Expand Down Expand Up @@ -374,7 +373,7 @@ function CarManageAdd(props) {

<ShortColumnContainer>
<TitleLabel>제조사</TitleLabel>
<InfoInput name='manufacturer' value={capacity} onChange={onChangeInput}/>
<InfoInput name='manufacturer' value={manufacturer} onChange={onChangeInput}/>
</ShortColumnContainer>

<ShortColumnContainer>
Expand Down
2 changes: 0 additions & 2 deletions src/pages/admin/office/OfficeManageAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,6 @@ function OfficeManageAdd(props) {
})
.catch((Error) => {
basicError(Error)
console.log(Error)
window.alert("회의실 정보를 불러올 수 없습니댜.")
window.history.back()
})
}
Expand Down
16 changes: 7 additions & 9 deletions src/pages/admin/resource/ResourceManageAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function ResourceManageAdd(props) {
description: null,
};
const [inputValues, setInputValues] = useState(initialValue);
const {name, capacity, place, description} = inputValues; //비구조화 할당
const {name, manufacturer, place, description} = inputValues; //비구조화 할당
const [staff, setStaff] = useState({
userId: null,
name: ""
Expand Down Expand Up @@ -213,7 +213,7 @@ function ResourceManageAdd(props) {
// 이미지 람다 호출
const getImageUrl = () => {
// todo: 검사 다 하기
if (staff.facilityId === null) {
if (staff.userId === null) {
alert("책임자를 선택해주세요.");
return;
}
Expand Down Expand Up @@ -264,9 +264,9 @@ function ResourceManageAdd(props) {

const addResource = () => {
AdminResourcesAxios.post(``, {
responsibility: staff.facilityId,
responsibility: staff.userId,
description: description,
manufacturer: capacity,
manufacturer: manufacturer,
location: place,
name: name,
imgKey: imageFile === null ? null : `resource/${imageUrl.imageKey}`,
Expand All @@ -287,9 +287,9 @@ function ResourceManageAdd(props) {

const editResource = () => {
AdminResourcesAxios.patch(`/${resourceId}`, {
responsibility: staff.facilityId,
responsibility: staff.userId,
description: description,
manufacturer: capacity,
manufacturer: manufacturer,
location: place,
name: name,
imgKey: imageFile === null ? getImgKey(imageUrl) : `resource/${imageUrl.imageKey}`,
Expand Down Expand Up @@ -334,8 +334,6 @@ function ResourceManageAdd(props) {
})
.catch((Error) => {
basicError(Error)
console.log(Error)
window.alert("장비 정보를 불러올 수 없습니댜.")
window.history.back()
})
}
Expand Down Expand Up @@ -375,7 +373,7 @@ function ResourceManageAdd(props) {

<ShortColumnContainer>
<TitleLabel>제조사</TitleLabel>
<InfoInput name='manufacturer' value={capacity} onChange={onChangeInput}/>
<InfoInput name='manufacturer' value={manufacturer} onChange={onChangeInput}/>
</ShortColumnContainer>

<ShortColumnContainer>
Expand Down
10 changes: 5 additions & 5 deletions src/pages/basic/user/Login.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import styled from "styled-components"
import { Link } from 'react-router-dom';
import {Link} from 'react-router-dom';
import CNameImg from "assets/images/kor_nameLogo.svg"
import LogoImg from "assets/images/imgLogo.svg"
import { UsersAxios } from 'api/AxiosApi';
import { setCookie } from 'utils/CookiesUtil'
import { isLogin } from 'utils/IsLoginUtil';
import {basicError, notLogInError} from 'utils/ErrorHandlerUtil';
import {UsersAxios} from 'api/AxiosApi';
import {setCookie} from 'utils/CookiesUtil'
import {isLogin} from 'utils/IsLoginUtil';
import {notLogInError} from 'utils/ErrorHandlerUtil';

const Container = styled.div`
height: fit-content;
Expand Down

0 comments on commit 6f70c04

Please sign in to comment.