Skip to content

Commit

Permalink
feat: 이용약관 페이지 추가 및 회원가입 연결 (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
selfishAltruism committed Mar 6, 2024
1 parent aa99ad1 commit d06f55d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/configs/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export enum PAGE_URL {
SignUp = '/auth/signup',
FindPassword = '/auth/findPassword',
Admission = '/auth/admission',
UseTerms = '/useTerms',

Home = '/home',

Expand Down
2 changes: 2 additions & 0 deletions src/pages/auth/AuthPageSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Admission } from './admission';
import { FindPassword } from './findPassword';
import { SignIn } from './signIn';
import { SignUp } from './signUp';
import { UseTerms } from './useTerms';

import { PAGE_URL } from '@/configs/path';

Expand All @@ -13,5 +14,6 @@ export const AuthPageSwitch: React.FC = () => (
<Route path={PAGE_URL.Admission} component={Admission} />
<Route path={PAGE_URL.SignUp} component={SignUp} />
<Route path={PAGE_URL.FindPassword} component={FindPassword} />
<Route path={PAGE_URL.UseTerms} component={UseTerms} />
</Switch>
);
2 changes: 1 addition & 1 deletion src/pages/auth/findPassword/FindPasswordPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const FindPasswordPage: React.FC = observer(() => {

return (
<>
<Header title="비밀번호 재발급" withBack={PAGE_URL.Board} />
<Header title="비밀번호 재발급" withBack={PAGE_URL.SignIn} />
<PageBody>
{isSubmitting ? (
<Loading />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/auth/signUp/SignUpPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const SignUpPage: React.FC = observer(() => {
const { success, message } = (await signUp(body)) as unknown as StoreAPI;

if (success) {
replace(PAGE_URL.SignIn);
replace(PAGE_URL.UseTerms);
alert({ message: '회원가입 되었습니다. 로그인 후 학부인증을 진행하세요.' });
} else if (message) {
alert({ message });
Expand Down
39 changes: 39 additions & 0 deletions src/pages/auth/useTerms/UseTermsPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { observer } from 'mobx-react-lite';
import React, { useEffect } from 'react';
import { useForm } from 'react-hook-form';
import { useHistory, generatePath } from 'react-router-dom';

import { BodyScreen, Header, PageBody, PageFooter, PageStoreHOC, NavButton } from '@/components';
import { PAGE_URL } from '@/configs/path';

const UseTermsPage: React.FC = observer(() => {
const {
replace,
push,
location: { pathname },
} = useHistory();
const { handleSubmit, formState } = useForm<User.FindPasswordReqestDto>();
const { isSubmitting } = formState;

const onSubmit = async () => {
if (pathname === PAGE_URL.SignUp) replace(PAGE_URL.SignIn);
else push(generatePath(pathname));
};

return (
<>
<Header title="이용 약관" />
<PageBody>
<BodyScreen>어쩌고 저쩌고</BodyScreen>
</PageBody>

<PageFooter>
<NavButton disabled={isSubmitting} onClick={handleSubmit(onSubmit)}>
위 약관을 모두 확인했습니다.
</NavButton>
</PageFooter>
</>
);
});

export default PageStoreHOC(<UseTermsPage />);
1 change: 1 addition & 0 deletions src/pages/auth/useTerms/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as UseTerms } from './UseTermsPage';

0 comments on commit d06f55d

Please sign in to comment.