Skip to content

Commit

Permalink
Merge pull request #203 from SW-CSS/develop
Browse files Browse the repository at this point in the history
RELEASE
  • Loading branch information
llddang authored Sep 12, 2024
2 parents cc3cdc1 + bc785bf commit a3d1fa3
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 (
<Formik
initialValues={initialValues}
validationSchema={validationSchema}
onSubmit={(values, { setSubmitting }) => {
setSubmitting(false);
handleSubmitButtonClick(values);
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/app/(client)/(withSidebar)/my-page/edit/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Title from '@/components/Title';

const Page = () => {
return (
<div className="flex w-full flex-col gap-4 rounded-sm bg-white p-5">
<Title title="내 정보 수정" />

<div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div>
</div>
);
};

export default Page;
9 changes: 9 additions & 0 deletions frontend/src/app/admin/contest/create/page.tsx
Original file line number Diff line number Diff line change
@@ -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;
9 changes: 9 additions & 0 deletions frontend/src/app/admin/contest/list/page.tsx
Original file line number Diff line number Diff line change
@@ -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;
5 changes: 3 additions & 2 deletions frontend/src/app/admin/faculty/list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -33,7 +34,7 @@ const Page = ({ searchParams }: { searchParams?: { [key: string]: string | undef
totalItems={members.length}
pathname={pathname}
query={JSON.stringify(searchParams)}
/>
/> */}
</div>
);
};
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/admin/faculty/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/app/admin/member/list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -34,7 +35,7 @@ const Page = ({ searchParams }: { searchParams?: { [key: string]: string | undef
totalItems={members.length}
pathname={pathname}
query={JSON.stringify(searchParams)}
/>
/> */}
</div>
);
};
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/app/admin/team-building/page.tsx
Original file line number Diff line number Diff line change
@@ -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;
10 changes: 10 additions & 0 deletions frontend/src/lib/hooks/useApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
});
}

0 comments on commit a3d1fa3

Please sign in to comment.