-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from Kernel360/page-find-password
페이지 UI: 비밀번호 찾기 페이지
- Loading branch information
Showing
7 changed files
with
114 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.mainContainer { | ||
padding: 0 24px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* eslint-disable @typescript-eslint/no-misused-promises */ | ||
/* eslint-disable no-console */ | ||
|
||
'use client'; | ||
|
||
import { useForm } from 'react-hook-form'; | ||
|
||
import classNames from 'classnames/bind'; | ||
import dynamic from 'next/dynamic'; | ||
|
||
import VALIDATION_MESSAGE_MAP from '@constants/validationMessage'; | ||
import { FindPassword } from '@remote/api/types/auth'; | ||
import useFindPassword from '@remote/queries/auth/useFindPassword'; | ||
import Header from '@shared/header/Header'; | ||
import Spacing from '@shared/spacing/Spacing'; | ||
import TextField from '@shared/text-field/TextField'; | ||
import Title from '@shared/title/Title'; | ||
|
||
import styles from './page.module.scss'; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
const FixedBottomButton = dynamic(() => { return import('@shared/fixedBottomButton/FixedBottomButton'); }, { | ||
ssr: false, | ||
}); | ||
|
||
function FindPasswordPage() { | ||
const { | ||
register, handleSubmit, | ||
formState: { isValid, isDirty }, | ||
} = useForm<FindPassword>({ | ||
mode: 'onBlur', | ||
}); | ||
const { mutate, isError } = useFindPassword(); | ||
|
||
const onSubmit = (data: FindPassword) => { | ||
const { id } = data; | ||
mutate({ id }, { | ||
onSuccess: () => { | ||
alert('비밀번호 변경 페이지로 이동'); | ||
// TODO: 비밀번호 변경 페이지 로드하기 | ||
}, | ||
}); | ||
|
||
console.log(id); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Header isDisplayLogo={false} /> | ||
<Spacing size={16} /> | ||
<main className={cx('mainContainer')}> | ||
<Title title="비밀번호 찾기" description="비밀번호를 찾으실 아이디를 입력해주세요." size={4} descriptionColor="tertiary" /> | ||
<Spacing size={40} /> | ||
<TextField | ||
label="아이디" | ||
required | ||
placeholder="아이디" | ||
{...register('id', { | ||
required: true, | ||
pattern: VALIDATION_MESSAGE_MAP.id.value, | ||
})} | ||
hasError={isError} | ||
helpMessage={VALIDATION_MESSAGE_MAP.failedFindPassword.message} | ||
/> | ||
<div> | ||
<FixedBottomButton | ||
disabled={!isValid || !isDirty} | ||
onClick={handleSubmit(onSubmit)} | ||
size="medium" | ||
> | ||
다음 | ||
</FixedBottomButton> | ||
</div> | ||
</main> | ||
</> | ||
); | ||
} | ||
export default FindPasswordPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
|
||
import { findPassword } from '@remote/api/requests/auth/auth.post.api'; | ||
|
||
function useFindPassword() { | ||
return useMutation({ mutationFn: findPassword }); | ||
} | ||
|
||
export default useFindPassword; |