From ba17c7cbdaaba2bf5369e86d95fe99fa987ee55a Mon Sep 17 00:00:00 2001 From: Minji Lee <79428205+alswlfl29@users.noreply.github.com> Date: Mon, 8 Jul 2024 09:09:28 +0900 Subject: [PATCH] =?UTF-8?q?[Fix/#55]=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#56)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 모집인원, 가격 숫자만 입력 가능하게 * fix: qr 카메라 꺼지게, 영역 제한 * fix: 비밀번호 눌렀을 때 hover 제거 * fix: 날짜, 시간 input css 수정 * fix: 토큰 만료시 response 처리 --- src/apis/apiClient.ts | 27 ++++++------ src/components/molecules/AddLessonInput.tsx | 8 ++++ .../molecules/AddLessonTimeList.tsx | 1 - src/components/molecules/PasswordKeypad.tsx | 4 +- src/components/molecules/QRScanner.tsx | 43 ++++++++++++++----- src/index.css | 12 ++++++ src/pages/main/HanaFunMain.tsx | 2 +- src/pages/search/LessonDetail.tsx | 9 +++- 8 files changed, 78 insertions(+), 28 deletions(-) diff --git a/src/apis/apiClient.ts b/src/apis/apiClient.ts index 4766b55..996eed5 100644 --- a/src/apis/apiClient.ts +++ b/src/apis/apiClient.ts @@ -7,8 +7,6 @@ import { hostApi } from './interfaces/hostApi'; import { categoryApi } from './interfaces/categoryApi'; import { transactionApi } from './interfaces/transactionApi'; import { reservationApi } from './interfaces/reservationApi'; -import { useNavigate } from 'react-router-dom'; -import { useModal } from '../context/ModalContext'; export class ApiClient implements @@ -397,18 +395,23 @@ export class ApiClient } ); - newInstance.interceptors.response.use((response) => { - if (response.status === 403) { - removeCookie('token'); - removeCookie('username'); - location.href = '/'; - } + newInstance.interceptors.response.use( + (response) => { + console.log('dd', response); + return response; + }, + (error) => { + console.log(error.response.status); + if (error.response.status === 403) { + alert('로그아웃되었습니다.'); + removeCookie('token'); + removeCookie('username'); + location.href = '/hana'; + } - if (response.status === 404) { - location.href = '/error'; + return Promise.reject(error); } - return response; - }); + ); return newInstance; }; diff --git a/src/components/molecules/AddLessonInput.tsx b/src/components/molecules/AddLessonInput.tsx index 56bc2d6..5b7e648 100644 --- a/src/components/molecules/AddLessonInput.tsx +++ b/src/components/molecules/AddLessonInput.tsx @@ -10,6 +10,13 @@ interface IProps { export const AddLessonInput = forwardRef( (props: IProps, ref: Ref) => { + const onInputNumber = (event: React.ChangeEvent) => { + if (props.type === 'number') { + event.target.value = event.target.value + .replace(/[^0-9.]/g, '') + .replace(/(\..*)\./g, ''); + } + }; return ( diff --git a/src/components/molecules/AddLessonTimeList.tsx b/src/components/molecules/AddLessonTimeList.tsx index 59ba1aa..f860620 100644 --- a/src/components/molecules/AddLessonTimeList.tsx +++ b/src/components/molecules/AddLessonTimeList.tsx @@ -124,7 +124,6 @@ export const AddLessonTimeList: FC = ({ onChangeTimes }) => {

= ({ {[1, -1, 2, -1, 3, 4, 5, 6, 7, 8, 9, 0].map((num, index) => ( ))}