'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import { useLocalStorage } from 'usehooks-ts' import { axiosInstance } from '@/libs/axios' import { useSessionStore } from '@/store/session' export default function PwResetForm() { const [pwShow01, setPwShow01] = useState(false) //비밀번호 확인 보이기 숨기기 const [pwShow02, setPwShow02] = useState(false) //비밀번호 재확인 보이기 숨기기 const [pwd01, setPwd01] = useState('') const [pwd02, setPwd02] = useState('') const router = useRouter() const { session } = useSessionStore() const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' }) const validatePwd = () => { if (pwd01 !== pwd02) { alert('비밀번호가 일치하지 않습니다.') return false } return true } const handleReset = async () => { if (validatePwd()) { const { data } = await axiosInstance(null).post(`/api/auth/chg-pwd`, { loginId: session.userId, email: session.email, pwd: value.indivisualData, chgPwd: pwd01, }) if (data.data.result.resultCode === 'S') { setValue({ indivisualData: pwd01 }) } window.neoAlert(data.data.result.resultMsg, () => { router.back() }) } } return ( <>
新規パスワード再入力 *
setPwd01(e.target.value)} />
10文字以内
新規パスワード入力 *
setPwd02(e.target.value)} />
10文字以内
) }