File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
components/ChangePassword Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { useChangePasswordState } from '@/stores/changePasswordStore' ;
2
+ import { LooseValidation , ValidateProcessor } from '@/utils/authUtils' ;
3
+ import InputForm from '../common/InputForm' ;
4
+
5
+ const ChangePasswordInput = ( ) => {
6
+ const { password, passwordHandler } = useChangePasswordState ( ) ;
7
+ const validator = new ValidateProcessor ( new LooseValidation ( ) ) ;
8
+ return (
9
+ < InputForm
10
+ defaultValue = { password }
11
+ title = { '비밀번호' }
12
+ placeholder = { '변경할 비밀번호를 입력해 주세요.' }
13
+ hint = { '' }
14
+ onChange = { ( e ) => passwordHandler ( e . target . value ) }
15
+ name = { 'password' }
16
+ type = { 'password' }
17
+ id = { 'change-password-input' }
18
+ aria-label = { 'change-password-input' }
19
+ error = { ! validator . isValidPassword ( password ) }
20
+ errorText = { '비밀번호는 6자리 이상이어야 합니다.' }
21
+ />
22
+ ) ;
23
+ } ;
24
+
25
+ export default ChangePasswordInput ;
Original file line number Diff line number Diff line change
1
+ import { create } from 'zustand' ;
2
+
3
+ interface ChangePasswordState {
4
+ password : string ;
5
+
6
+ passwordHandler : ( password : string ) => void ;
7
+ }
8
+
9
+ export const useChangePasswordState = create < ChangePasswordState > ( ) ( ( set ) => ( {
10
+ password : '' ,
11
+
12
+ passwordHandler : ( password : string ) => set ( ( ) => ( { password } ) ) ,
13
+ } ) ) ;
You can’t perform that action at this time.
0 commit comments