본문 바로가기
React

비밀번호 변경 폼 resetpassword form handleEvent

by 바나냥 2020. 7. 27.
    const handleEvent = (e: React.ChangeEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement>): void => {
        const { value } = e.currentTarget;
        const { name: targetName } = e.target;

        if (targetName === 'password') {
            setPassword(value);
        } else if (targetName === 'passwordNew') {
            setPasswordNew(value);
        } else if (targetName === 'passwordNewRe') {
            setPasswordNewRe(value);
        }
    };
            <Input
                ref={inputPasswordRef}
                name="password"
                disabled={false}
                type="password"
                label={t('임시 비밀번호')}
                placeholder={t('임시 비밀번호 입력')}
                handleInputChange={handleEvent}
            />
            <Input
                ref={inputPasswordNewRef}
                className="mb-0"
                name="passwordNew"
                disabled={false}
                type="password"
                label={t('새 비밀번호')}
                placeholder={t('새 비밀번호 입력')}
                handleInputChange={handleEvent}
            />
            <Text>
                {t('영문 대/소문자, 숫자, 특수문자 포함 8~24자')}
                <br />
                {t('연속적인 숫자 사용불가(예:111, 333)')}
            </Text>
            <Input
                ref={inputPasswordNewReRef}
                name="passwordNewRe"
                disabled={false}
                type="password"
                label={t('새 비밀번호 확인')}
                handleInputChange={handleEvent}
                placeholder={t('새 비밀번호 입력')}
            />

댓글