From c908079b6272f1b391504e0a954fd68937dd465a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EB=AF=BC=EC=B0=AC?= <132974029+wjzlskxk@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:50:07 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat=20::=20=ED=98=84=EC=9E=AC=20=EB=B2=84?= =?UTF-8?q?=EC=8A=A4=20=EC=9D=B8=EC=9B=90=EC=88=98=20=ED=91=9C=EC=8B=9C=20?= =?UTF-8?q?#41?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contents/BusApply/BusOption/BusOption.tsx | 28 ++++++++----------- src/hooks/busApply/useBusApply.ts | 25 +++++++++-------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/components/MyInfo/Contents/BusApply/BusOption/BusOption.tsx b/src/components/MyInfo/Contents/BusApply/BusOption/BusOption.tsx index 2ad34e2..b21c0e6 100644 --- a/src/components/MyInfo/Contents/BusApply/BusOption/BusOption.tsx +++ b/src/components/MyInfo/Contents/BusApply/BusOption/BusOption.tsx @@ -1,5 +1,5 @@ -import { Bus } from "../../../../../types/busApply/busApply.type"; -import * as S from "./style"; +import { Bus } from '../../../../../types/busApply/busApply.type'; +import * as S from './style'; interface Props { data: Bus; @@ -8,32 +8,26 @@ interface Props { } const BusOption = ({ data, isSelect, onChangeApplyBus }: Props) => { - const [busNumber, busName] = data.busName.split(" "); + const [busNumber, busName] = data.busName.split(' '); return ( - <S.BusOptionWrap - isSelect={isSelect} - onClick={() => onChangeApplyBus(data.id)} - > - {busNumber === "미탑승" ? ( + <S.BusOptionWrap isSelect={isSelect} onClick={() => onChangeApplyBus(data.id)}> + {busNumber === '미탑승' ? ( <> + <S.BusOptionStationText isSelect={isSelect}>{busNumber}</S.BusOptionStationText> <S.BusOptionStationText isSelect={isSelect}> - {busNumber} - </S.BusOptionStationText> - <S.BusOptionStationText isSelect={isSelect}> - ({data.leaveTime.split(" ")[1].substring(0, 5)}) + ({data.leaveTime.split(' ')[1].substring(0, 5)}) </S.BusOptionStationText> </> ) : ( <> + <S.BusOptionStationText isSelect={isSelect}>{busNumber}</S.BusOptionStationText> <S.BusOptionStationText isSelect={isSelect}> - {busNumber} - </S.BusOptionStationText> - <S.BusOptionStationText isSelect={isSelect}> - {busName} + {data.applyCount}/{data.peopleLimit} </S.BusOptionStationText> + <S.BusOptionStationText isSelect={isSelect}>{busName}</S.BusOptionStationText> <S.BusOptionStationText isSelect={isSelect}> - ({data.leaveTime.split(" ")[1].substring(0, 5)}) + ({data.leaveTime.split(' ')[1].substring(0, 5)}) </S.BusOptionStationText> </> )} diff --git a/src/hooks/busApply/useBusApply.ts b/src/hooks/busApply/useBusApply.ts index f5dde49..3d54968 100644 --- a/src/hooks/busApply/useBusApply.ts +++ b/src/hooks/busApply/useBusApply.ts @@ -1,13 +1,13 @@ -import { B1ndToast } from "@b1nd/b1nd-toastify"; -import { useEffect, useState } from "react"; -import busApplyRepository from "../../repository/busApply/busApply.repository"; -import { Bus } from "../../types/busApply/busApply.type"; +import { B1ndToast } from '@b1nd/b1nd-toastify'; +import { useEffect, useState } from 'react'; +import busApplyRepository from '../../repository/busApply/busApply.repository'; +import { Bus } from '../../types/busApply/busApply.type'; const useBusApply = () => { const [serverBusData, setServerBusData] = useState<Bus[]>([]); const [selectedBusId, setSelectedBusId] = useState<number>(-1); const [selectBusId, setSelectBusId] = useState<number>(-1); - const [busDate, setBusDate] = useState(""); + const [busDate, setBusDate] = useState(''); const [isChange, setIsChange] = useState(false); const mappingBusData = async () => { @@ -46,10 +46,11 @@ const useBusApply = () => { const onSubmitBusApply = async () => { try { await busApplyRepository.postBusApply({ idx: String(selectBusId) }); - B1ndToast.showSuccess("버스 신청 성공"); + B1ndToast.showSuccess('버스 신청 성공'); + mappingBusData(); setSelectedBusId(selectBusId); } catch (error) { - B1ndToast.showError("버스 신청 실패"); + B1ndToast.showError('버스 신청 실패'); } }; @@ -58,10 +59,11 @@ const useBusApply = () => { await busApplyRepository.patchBusApply({ idx: String(selectBusId), }); - B1ndToast.showSuccess("버스 수정 성공"); + B1ndToast.showSuccess('버스 수정 성공'); + mappingBusData(); setSelectedBusId(selectBusId); } catch (error) { - B1ndToast.showInfo("버스 수정 실패"); + B1ndToast.showInfo('버스 수정 실패'); } }; const deleteBusApply = async () => { @@ -69,11 +71,12 @@ const useBusApply = () => { await busApplyRepository.deleteBusApply({ idx: String(selectBusId), }); - B1ndToast.showSuccess("버스 신청 취소"); + B1ndToast.showSuccess('버스 신청 취소'); + mappingBusData(); setSelectBusId(-1); setSelectedBusId(-1); } catch (error) { - B1ndToast.showInfo("버스 신청취소 실패"); + B1ndToast.showInfo('버스 신청취소 실패'); } }; const onChangeApplyBus = (busId: number) => setSelectBusId(busId); From 9ecfc2e4e9b6663d29075066d3721f6b8b15cc48 Mon Sep 17 00:00:00 2001 From: ftery0 <lerb5253@dgsw.hs.kr> Date: Mon, 25 Nov 2024 09:15:41 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix=20::=20api=20=EC=A3=BC=EC=86=8C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/repository/busApply/busApply.repository.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repository/busApply/busApply.repository.ts b/src/repository/busApply/busApply.repository.ts index b9c48c6..7dc7147 100644 --- a/src/repository/busApply/busApply.repository.ts +++ b/src/repository/busApply/busApply.repository.ts @@ -21,7 +21,7 @@ class BusApplyRepository { } public async patchBusApply({ idx }: BusApplyParam): Promise<void> { - await customAxios.patch(`/bus/apply/${idx}`); + await customAxios.patch(`/bus/apply/status/${idx}`); } public async deleteBusApply({ idx }: BusApplyParam): Promise<void>{ From dc3828847964ac42eb45738bfb24e9e6d482a490 Mon Sep 17 00:00:00 2001 From: ftery0 <lerb5253@dgsw.hs.kr> Date: Mon, 25 Nov 2024 17:21:22 +0900 Subject: [PATCH 3/4] =?UTF-8?q?refactor=20::=20bus=20api=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/repository/busApply/busApply.repository.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repository/busApply/busApply.repository.ts b/src/repository/busApply/busApply.repository.ts index 7dc7147..600c983 100644 --- a/src/repository/busApply/busApply.repository.ts +++ b/src/repository/busApply/busApply.repository.ts @@ -17,7 +17,7 @@ class BusApplyRepository { } public async postBusApply({ idx }: BusApplyParam): Promise<void> { - await customAxios.post(`/bus/apply/${idx}`); + await customAxios.patch(`/bus/apply/status/${idx}`); } public async patchBusApply({ idx }: BusApplyParam): Promise<void> { From 14259a2c7dbb79d1c4ed50615019626d816db371 Mon Sep 17 00:00:00 2001 From: ftery0 <lerb5253@dgsw.hs.kr> Date: Mon, 25 Nov 2024 17:29:59 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix=20::=20=ED=94=BC=EB=93=9C=EB=B0=B1=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyInfo/Contents/BusApply/BusOption/BusOption.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/MyInfo/Contents/BusApply/BusOption/BusOption.tsx b/src/components/MyInfo/Contents/BusApply/BusOption/BusOption.tsx index b21c0e6..dedf011 100644 --- a/src/components/MyInfo/Contents/BusApply/BusOption/BusOption.tsx +++ b/src/components/MyInfo/Contents/BusApply/BusOption/BusOption.tsx @@ -21,10 +21,7 @@ const BusOption = ({ data, isSelect, onChangeApplyBus }: Props) => { </> ) : ( <> - <S.BusOptionStationText isSelect={isSelect}>{busNumber}</S.BusOptionStationText> - <S.BusOptionStationText isSelect={isSelect}> - {data.applyCount}/{data.peopleLimit} - </S.BusOptionStationText> + <S.BusOptionStationText isSelect={isSelect}>{busNumber} {data.applyCount}/{data.peopleLimit}</S.BusOptionStationText> <S.BusOptionStationText isSelect={isSelect}>{busName}</S.BusOptionStationText> <S.BusOptionStationText isSelect={isSelect}> ({data.leaveTime.split(' ')[1].substring(0, 5)})