From c77c34a6c5d42c0824f46cb8715e9e405529578a Mon Sep 17 00:00:00 2001 From: llddang <77055208+llddang@users.noreply.github.com> Date: Fri, 13 Sep 2024 03:10:47 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Feature/#199=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=B4=88=EA=B8=B0=ED=99=94=20api=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20(#201)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 임시비밀번호 발송 api 정의 #199 * feat: 임시비밀번호 발송 api 연결 #199 * feat: toast가 닫히면 로그인 페이지로 이동하도록 router 추가 #199 * feat: 비밀번호 초기화 form 에서 validate 삭제 #199 --- .../components/FindForm/index.tsx | 32 ++++++++++++------- frontend/src/lib/hooks/useApi.ts | 10 ++++++ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/(client)/(auth)/find-password/components/FindForm/index.tsx b/frontend/src/app/(client)/(auth)/find-password/components/FindForm/index.tsx index c3cfcd11..c909dfb0 100644 --- a/frontend/src/app/(client)/(auth)/find-password/components/FindForm/index.tsx +++ b/frontend/src/app/(client)/(auth)/find-password/components/FindForm/index.tsx @@ -1,18 +1,12 @@ 'use client'; import { Form, Formik } from 'formik'; -import * as Yup from 'yup'; import EmailTextInput from '@/components/Formik/EmailTextInput'; import TextInput from '@/components/Formik/TextInput'; - -const validationSchema = Yup.object().shape({ - email: Yup.string() - .required('필수 입력란입니다. 이메일을 입력해주세요.') - .matches(/^((?!@).)*$/, '부산대 이메일만 가입 가능합니다. 이메일 도메인 부분을 삭제해주세요.') - .matches(/^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*$/, '존재하는 이메일인지 확인해주세요.'), - name: Yup.string().required('필수 입력란입니다. 이름을 입력해주세요.'), -}); +import { useResetPasswordMutation } from '@/lib/hooks/useApi'; +import { toast } from 'react-toastify'; +import { useRouter } from 'next/navigation'; interface FormType { email: string; @@ -25,15 +19,29 @@ const initialValues: FormType = { }; const FindForm = () => { + const { mutate: resetPasswordMutation } = useResetPasswordMutation(); + const router = useRouter(); + const handleSubmitButtonClick = (values: FormType) => { - // TODO: 메일 발송 api 호출 - console.log(JSON.stringify(values)); + resetPasswordMutation( + { email: values.email, name: values.name }, + { + onSuccess(data, variables, context) { + toast.info('임시비밀번호 메일이 발송되었습니다.'); + setTimeout(function () { + router.push('/sign-in'); + }, 2000); + }, + onError(error, variables, context) { + toast.error(error.message); + }, + }, + ); }; return ( { setSubmitting(false); handleSubmitButtonClick(values); diff --git a/frontend/src/lib/hooks/useApi.ts b/frontend/src/lib/hooks/useApi.ts index be689651..b90360b1 100644 --- a/frontend/src/lib/hooks/useApi.ts +++ b/frontend/src/lib/hooks/useApi.ts @@ -286,3 +286,13 @@ export function useSignInMutation() { .catch((err) => Promise.reject(err)), }); } + +export function useResetPasswordMutation() { + return useAxiosMutation({ + mutationFn: async ({ email, name }: { email: string; name: string }) => + await client + .patch(`/sign-in/reset-password`, { email: email + '@pusan.ac.kr', name }) + .then((res) => res.data) + .catch((err) => Promise.reject(err)), + }); +} From bc785bf4e69cdc372f1108c035b5e41e911f356b Mon Sep 17 00:00:00 2001 From: llddang <77055208+llddang@users.noreply.github.com> Date: Fri, 13 Sep 2024 03:23:12 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Feature/#200=20=EA=B0=9C=EB=B0=9C=EC=A4=91?= =?UTF-8?q?=EC=9D=B8=20=EA=B8=B0=EB=8A=A5=20=ED=91=9C=EC=8B=9C=20(#202)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 내 정보 수정 페이지 개발 중이라고 표시 #200 * feat: 어드민에서 대회 관리 페이지 개발 중이라고 표시 #200 * feat: 관리자에서 교직원 관련 페이지 개발중이라고 표시 #200 * feat: 관리자페이지에서 학생 관리 페이지 구현중이라고 표시 #200 * feat: 팀빌딩 페이지 개발중이라고 표시 #200 --- .../(client)/(withSidebar)/my-page/edit/page.tsx | 13 +++++++++++++ frontend/src/app/admin/contest/create/page.tsx | 9 +++++++++ frontend/src/app/admin/contest/list/page.tsx | 9 +++++++++ frontend/src/app/admin/faculty/list/page.tsx | 5 +++-- frontend/src/app/admin/faculty/register/page.tsx | 2 ++ frontend/src/app/admin/member/list/page.tsx | 5 +++-- frontend/src/app/admin/team-building/page.tsx | 9 +++++++++ 7 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 frontend/src/app/(client)/(withSidebar)/my-page/edit/page.tsx create mode 100644 frontend/src/app/admin/contest/create/page.tsx create mode 100644 frontend/src/app/admin/contest/list/page.tsx create mode 100644 frontend/src/app/admin/team-building/page.tsx diff --git a/frontend/src/app/(client)/(withSidebar)/my-page/edit/page.tsx b/frontend/src/app/(client)/(withSidebar)/my-page/edit/page.tsx new file mode 100644 index 00000000..429d9ef8 --- /dev/null +++ b/frontend/src/app/(client)/(withSidebar)/my-page/edit/page.tsx @@ -0,0 +1,13 @@ +import Title from '@/components/Title'; + +const Page = () => { + return ( +
+ + + <div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div> + </div> + ); +}; + +export default Page; diff --git a/frontend/src/app/admin/contest/create/page.tsx b/frontend/src/app/admin/contest/create/page.tsx new file mode 100644 index 00000000..bf4f4cdf --- /dev/null +++ b/frontend/src/app/admin/contest/create/page.tsx @@ -0,0 +1,9 @@ +const Page = () => { + return ( + <div className="w-full"> + <div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div> + </div> + ); +}; + +export default Page; diff --git a/frontend/src/app/admin/contest/list/page.tsx b/frontend/src/app/admin/contest/list/page.tsx new file mode 100644 index 00000000..bf4f4cdf --- /dev/null +++ b/frontend/src/app/admin/contest/list/page.tsx @@ -0,0 +1,9 @@ +const Page = () => { + return ( + <div className="w-full"> + <div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div> + </div> + ); +}; + +export default Page; diff --git a/frontend/src/app/admin/faculty/list/page.tsx b/frontend/src/app/admin/faculty/list/page.tsx index 42b6bcb6..59bb374a 100644 --- a/frontend/src/app/admin/faculty/list/page.tsx +++ b/frontend/src/app/admin/faculty/list/page.tsx @@ -21,7 +21,8 @@ const Page = ({ searchParams }: { searchParams?: { [key: string]: string | undef return ( <div className="w-full"> - <div className="flex items-center rounded-sm border-[1px] border-admin-border bg-admin-background-light px-5 py-3 text-sm"> + <div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div> + {/* <div className="flex items-center rounded-sm border-[1px] border-admin-border bg-admin-background-light px-5 py-3 text-sm"> <span className="mr-20"> 총 <span className="text-admin-primary-main">{members.length}</span>명의 회원이 있습니다. </span> @@ -33,7 +34,7 @@ const Page = ({ searchParams }: { searchParams?: { [key: string]: string | undef totalItems={members.length} pathname={pathname} query={JSON.stringify(searchParams)} - /> + /> */} </div> ); }; diff --git a/frontend/src/app/admin/faculty/register/page.tsx b/frontend/src/app/admin/faculty/register/page.tsx index 239172a2..459f56b7 100644 --- a/frontend/src/app/admin/faculty/register/page.tsx +++ b/frontend/src/app/admin/faculty/register/page.tsx @@ -67,6 +67,8 @@ const Page = () => { } }; + return <div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div>; + return ( <> <div className="mb-10 rounded-sm border-[1px] border-admin-border bg-admin-background-light px-5 py-3"> diff --git a/frontend/src/app/admin/member/list/page.tsx b/frontend/src/app/admin/member/list/page.tsx index 25e04b94..e6723a65 100644 --- a/frontend/src/app/admin/member/list/page.tsx +++ b/frontend/src/app/admin/member/list/page.tsx @@ -22,7 +22,8 @@ const Page = ({ searchParams }: { searchParams?: { [key: string]: string | undef return ( <div className="w-full"> - <div className="flex items-center rounded-sm border-[1px] border-admin-border bg-admin-background-light px-5 py-3 text-sm"> + <div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div> + {/* <div className="flex items-center rounded-sm border-[1px] border-admin-border bg-admin-background-light px-5 py-3 text-sm"> <span className="mr-20"> 총 <span className="text-admin-primary-main">{members.length}</span>명의 회원이 있습니다. </span> @@ -34,7 +35,7 @@ const Page = ({ searchParams }: { searchParams?: { [key: string]: string | undef totalItems={members.length} pathname={pathname} query={JSON.stringify(searchParams)} - /> + /> */} </div> ); }; diff --git a/frontend/src/app/admin/team-building/page.tsx b/frontend/src/app/admin/team-building/page.tsx new file mode 100644 index 00000000..bf4f4cdf --- /dev/null +++ b/frontend/src/app/admin/team-building/page.tsx @@ -0,0 +1,9 @@ +const Page = () => { + return ( + <div className="w-full"> + <div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div> + </div> + ); +}; + +export default Page;