From 32d964b5ce198fc2d70399bd07a7990e1adb4bae Mon Sep 17 00:00:00 2001 From: Daeeui Kim Date: Tue, 26 Mar 2024 22:35:27 +0900 Subject: [PATCH 1/8] =?UTF-8?q?fix:=20=EC=97=90=EB=9F=AC=20=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/query/register.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/query/register.ts b/src/query/register.ts index 2f162618..8a977580 100644 --- a/src/query/register.ts +++ b/src/query/register.ts @@ -2,6 +2,7 @@ import { useMutation, useQuery } from '@tanstack/react-query'; import { getEmailAuthCode, getEmailDuplicate, getFileUrls, registerUser, verificationAuthCode, } from 'api/register'; +import axios from 'axios'; import parseRegisterData from 'page/Auth/Signup/utils/parseRegisterData'; import useRegisterInfo from 'store/registerStore'; import useShopRegistrationStore from 'store/shopRegistration'; @@ -83,7 +84,9 @@ export const useGetFileUrls = (goNext:()=>void) => { try { await register.mutateAsync(data.file_urls); } catch (e) { - showToast('error', `회원가입 중 에러가 발생했어요${e}`); + if (axios.isAxiosError(e)) { + showToast('error', `${e.response?.data.message || e.message}`); + } } } catch (e) { showToast('error', `파일업로드 중 에러가 발생했어요${e}`); From 452467f688254e7af0035c4252000b273218ac3d Mon Sep 17 00:00:00 2001 From: Daeeui Kim Date: Tue, 26 Mar 2024 22:35:50 +0900 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20=EC=97=90=EB=9F=AC=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=83=81=ED=83=9C=EA=B0=92=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/query/auth.ts | 7 +++++-- src/store/errorMessageStore.ts | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/query/auth.ts b/src/query/auth.ts index d7d2179c..1b5bb653 100644 --- a/src/query/auth.ts +++ b/src/query/auth.ts @@ -15,7 +15,7 @@ interface VerifyInput { verify: string; } -interface ErrorResponse { +export interface ErrorResponse { response: undefined | { message: string; data: { @@ -33,7 +33,7 @@ interface ErrorResponse { export const useLogin = () => { const navigate = useNavigate(); const { setPrevPath } = usePrevPathStore((state) => state); - const { setLoginError } = useErrorMessageStore(); + const { setLoginError, setLoginErrorCode } = useErrorMessageStore(); const { mutate, error, isError } = useMutation({ mutationFn: (variables: LoginForm) => postLogin({ @@ -58,6 +58,9 @@ export const useLogin = () => { sessionStorage.removeItem('access_token'); localStorage.removeItem('refresh_token'); setLoginError(err.response?.data.message || err.message); + if (err.response?.data && 'code' in err.response.data) { + setLoginErrorCode(err.response?.data?.code as number); + } }, }); diff --git a/src/store/errorMessageStore.ts b/src/store/errorMessageStore.ts index 8497ab41..648d0040 100644 --- a/src/store/errorMessageStore.ts +++ b/src/store/errorMessageStore.ts @@ -7,6 +7,8 @@ interface ErrorMessageStore { setCategoryError: (error: string) => void; loginError: string; setLoginError: (error: string) => void; + loginErrorCode: number; + setLoginErrorCode: (error: number) => void; } export const useErrorMessageStore = create((set) => ({ @@ -16,4 +18,6 @@ export const useErrorMessageStore = create((set) => ({ setCategoryError: (error) => set({ categoryError: error }), loginError: '', setLoginError: (error) => set({ loginError: error }), + loginErrorCode: 0, + setLoginErrorCode: (error) => set({ loginErrorCode: error }), })); From ff2dcc83b279a0d4da5a70df65560c59c83ef568 Mon Sep 17 00:00:00 2001 From: Daeeui Kim Date: Thu, 28 Mar 2024 20:19:17 +0900 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20=EC=8A=B9=EC=9D=B8=20=EB=AA=A8?= =?UTF-8?q?=EB=8B=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApprovalModal/ApprovalModal.module.scss | 72 +++++++++++++++++++ src/page/Auth/Login/ApprovalModal/index.tsx | 37 ++++++++++ src/page/Auth/Login/index.tsx | 6 +- 3 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/page/Auth/Login/ApprovalModal/ApprovalModal.module.scss create mode 100644 src/page/Auth/Login/ApprovalModal/index.tsx diff --git a/src/page/Auth/Login/ApprovalModal/ApprovalModal.module.scss b/src/page/Auth/Login/ApprovalModal/ApprovalModal.module.scss new file mode 100644 index 00000000..4655fca4 --- /dev/null +++ b/src/page/Auth/Login/ApprovalModal/ApprovalModal.module.scss @@ -0,0 +1,72 @@ +.background { + background-color: rgb(0 0 0 / 70%); + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; +} + +.container { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + color: #000000; + opacity: 1; + background-color: #ffffff; + width: 300px; + height: 200px; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 8px; + + &__title { + font-size: 18px; + font-weight: 500; + + span { + color: #175c8e; + } + } + + &__description { + display: flex; + flex-direction: column; + align-items: center; + font-size: 14px; + color: #8e8e8e; + } + + &__phone { + font-size: 16px; + color: #175c8e; + font-weight: 500; + } +} + +.button { + display: flex; + gap: 8px; + margin-top: 8px; + + &__confirm { + width: 115px; + height: 40px; + border-radius: 4px; + border: 1px solid #8e8e8e; + box-sizing: border-box; + cursor: pointer; + } + + &__clipboard { + width: 115px; + height: 40px; + border-radius: 4px; + background-color: #175c8e; + color: #ffffff; + cursor: pointer; + } +} diff --git a/src/page/Auth/Login/ApprovalModal/index.tsx b/src/page/Auth/Login/ApprovalModal/index.tsx new file mode 100644 index 00000000..02e68a65 --- /dev/null +++ b/src/page/Auth/Login/ApprovalModal/index.tsx @@ -0,0 +1,37 @@ +import { createPortal } from 'react-dom'; +import showToast from 'utils/ts/showToast'; +import styles from './ApprovalModal.module.scss'; + +const PHONE_NUMBER = '010-7724-5536'; + +export default function ApprovalModal({ toggle }:{ toggle: () => void }) { + const copyPhone = () => { + navigator.clipboard.writeText(PHONE_NUMBER).then(() => { + showToast('success', '전화번호를 클립보드에 복사하였습니다.'); + }).catch(() => { + showToast('error', '전화번호를 복사하는데 실패했습니다.'); + }); + }; + + return createPortal( +
+
+
+ 관리자의 승인 + 이 진행 중입니다. +
+
+ 해당 화면이 지속해서 보일 시 + 아래 연락처로 문의하시기 바랍니다. +
+
{PHONE_NUMBER}
+
+ + +
+
+ +
, + document.body, + ); +} diff --git a/src/page/Auth/Login/index.tsx b/src/page/Auth/Login/index.tsx index 29db67ae..668242a5 100644 --- a/src/page/Auth/Login/index.tsx +++ b/src/page/Auth/Login/index.tsx @@ -15,6 +15,7 @@ import sha256 from 'utils/ts/SHA-256'; import { useErrorMessageStore } from 'store/errorMessageStore'; import styles from './Login.module.scss'; import OPTION from './static/option'; +import ApprovalModal from './ApprovalModal'; export default function Login() { const { value: isBlind, changeValue: changeIsBlind } = useBooleanState(); @@ -23,8 +24,9 @@ export default function Login() { const { login, isError: isServerError } = useLogin(); const [isFormError, setIsFormError] = useState(false); const navigate = useNavigate(); - const { loginError } = useErrorMessageStore(); + const { loginError, loginErrorCode } = useErrorMessageStore(); const [emailError, setEmailError] = useState(''); + const { value: isModalOpen, changeValue: toggle } = useBooleanState(false); const isError = isServerError || isFormError; @@ -107,6 +109,7 @@ export default function Login() { [styles['form__button--login']]: true, })} type="submit" + onClick={toggle} > 로그인 @@ -132,6 +135,7 @@ export default function Login() { + {loginErrorCode === 100005 && isModalOpen && } ); } From a5632839dcc9c5a86e77b1dfa4fd4f3eda470aec Mon Sep 17 00:00:00 2001 From: Daeeui Kim Date: Fri, 29 Mar 2024 14:36:26 +0900 Subject: [PATCH 4/8] =?UTF-8?q?fix:=20useLogin=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/query/auth.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/query/auth.ts b/src/query/auth.ts index a4967bb4..8d2275d7 100644 --- a/src/query/auth.ts +++ b/src/query/auth.ts @@ -64,9 +64,7 @@ export const useLogin = () => { sessionStorage.removeItem('access_token'); localStorage.removeItem('refresh_token'); setLoginError(err.message || '로그인에 실패했습니다.'); - if (err.response?.data && 'code' in err.response.data) { - setLoginErrorCode(err.response?.data?.code as number); - } + setLoginErrorCode(err.code); } }, }); From 52f4512abdc9c559fc483d8fe2fc96de86b711b9 Mon Sep 17 00:00:00 2001 From: Daeeui Kim Date: Fri, 29 Mar 2024 15:33:06 +0900 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20singlePrice=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/addMenu.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/addMenu.ts b/src/store/addMenu.ts index eefc8e79..da643247 100644 --- a/src/store/addMenu.ts +++ b/src/store/addMenu.ts @@ -15,7 +15,7 @@ interface AddMenuStore { isSingle: boolean; name: string; optionPrices: OptionPrices[] | null; - singlePrice: number | null; + singlePrice: number; setCategoryIds: (categoryIds: number[]) => void; setDescription: (description: string) => void; setImageUrl: (newImageUrl: string) => void; @@ -79,7 +79,7 @@ const useAddMenuStore = create((set) => ({ isSingle: menuData.is_single, name: menuData.name, optionPrices: newOptionPrices, - singlePrice: 'single_price' in menuData ? menuData.single_price : null, + singlePrice: menuData.single_price !== null ? menuData.single_price : undefined, }); } }, From bcdc817b7824bf620fe28594f3eb5ade28164247 Mon Sep 17 00:00:00 2001 From: Daeeui Kim Date: Fri, 29 Mar 2024 15:33:32 +0900 Subject: [PATCH 6/8] =?UTF-8?q?feat:=20showToast=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/AddMenu/hook/useFormValidation.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/page/AddMenu/hook/useFormValidation.ts b/src/page/AddMenu/hook/useFormValidation.ts index 6afc46b4..f1331a19 100644 --- a/src/page/AddMenu/hook/useFormValidation.ts +++ b/src/page/AddMenu/hook/useFormValidation.ts @@ -1,5 +1,6 @@ import useAddMenuStore from 'store/addMenu'; import { useErrorMessageStore } from 'store/errorMessageStore'; +import showToast from 'utils/ts/showToast'; const useFormValidation = () => { const { setMenuError, setCategoryError } = useErrorMessageStore(); @@ -10,6 +11,7 @@ const useFormValidation = () => { if (name.length === 0) { setMenuError('메뉴명을 입력해주세요.'); + showToast('error', '메뉴명을 입력해주세요.'); isValid = false; } else { setMenuError(''); @@ -17,6 +19,7 @@ const useFormValidation = () => { if (categoryIds.length === 0) { setCategoryError('카테고리를 1개 이상 선택해주세요.'); + showToast('error', '카테고리를 1개 이상 선택해주세요.'); isValid = false; } else { setCategoryError(''); From a9f84b3caddb4b331a8dcb40955c76dbf65f3240 Mon Sep 17 00:00:00 2001 From: Daeeui Kim Date: Fri, 29 Mar 2024 15:34:02 +0900 Subject: [PATCH 7/8] =?UTF-8?q?feat:=20=EC=97=90=EB=9F=AC=20css=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AddMenu/components/MenuName/MenuName.module.scss | 8 ++++++++ src/page/AddMenu/components/MenuName/index.tsx | 11 +++++++++-- src/page/AddMenu/components/MenuPrice/index.tsx | 6 ++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/page/AddMenu/components/MenuName/MenuName.module.scss b/src/page/AddMenu/components/MenuName/MenuName.module.scss index 3b76b940..8916328d 100644 --- a/src/page/AddMenu/components/MenuName/MenuName.module.scss +++ b/src/page/AddMenu/components/MenuName/MenuName.module.scss @@ -25,6 +25,10 @@ font-size: 13px; font-weight: 400; } + + &--error { + border: 0.5px #f7941e solid; + } } &__name-text { @@ -67,6 +71,10 @@ font-size: 20px; font-weight: 400; } + + &--error { + border: 0.5px #f7941e solid; + } } .name-text { diff --git a/src/page/AddMenu/components/MenuName/index.tsx b/src/page/AddMenu/components/MenuName/index.tsx index a26499a7..56fa9fd5 100644 --- a/src/page/AddMenu/components/MenuName/index.tsx +++ b/src/page/AddMenu/components/MenuName/index.tsx @@ -1,6 +1,7 @@ import useMediaQuery from 'utils/hooks/useMediaQuery'; import useAddMenuStore from 'store/addMenu'; import { useErrorMessageStore } from 'store/errorMessageStore'; +import cn from 'utils/ts/className'; import styles from './MenuName.module.scss'; interface MenuNameProps { @@ -27,7 +28,10 @@ export default function MenuName({ isComplete }: MenuNameProps) { {name} ) : ( {name} ) : ( setSinglePrice(e.target.value === '' ? 0 : Number(e.target.value))} + value={singlePrice} + onChange={(e) => setSinglePrice(Number(e.target.value))} />

@@ -93,9 +93,7 @@ export default function MenuPrice({ isComplete }:MenuPriceProps) { <>
가격
-
-
From c3e4cd73c6443599a7d49d914145646539c940f6 Mon Sep 17 00:00:00 2001 From: Daeeui Kim Date: Fri, 29 Mar 2024 15:37:47 +0900 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=B6=94=EA=B0=80=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/AddMenu/components/MenuImage/index.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/page/AddMenu/components/MenuImage/index.tsx b/src/page/AddMenu/components/MenuImage/index.tsx index 91a83cf3..56d72131 100644 --- a/src/page/AddMenu/components/MenuImage/index.tsx +++ b/src/page/AddMenu/components/MenuImage/index.tsx @@ -48,6 +48,14 @@ export default function MenuImage({ isComplete }: MenuImageProps) {
(최대 이미지 3장)
+ {imageUrl.map((image, index) => (
{`Selected @@ -63,14 +71,6 @@ export default function MenuImage({ isComplete }: MenuImageProps) { )}
))} -