diff --git a/.yarn/cache/fsevents-patch-21ad2b1333-8.zip b/.yarn/cache/fsevents-patch-21ad2b1333-8.zip new file mode 100644 index 00000000..c6a96dfc Binary files /dev/null and b/.yarn/cache/fsevents-patch-21ad2b1333-8.zip differ diff --git a/src/page/Auth/hook/useStep.ts b/src/page/Auth/hook/useStep.ts index 7cb7502f..83c8fc57 100644 --- a/src/page/Auth/hook/useStep.ts +++ b/src/page/Auth/hook/useStep.ts @@ -13,10 +13,16 @@ export const useStep = (type: Type) => { const target = type === 'find' ? findPassword : register; const [index, setIndex] = useState(0); const [isComplete, setIsComplete] = useState(false); + const [isStepComplete, setIsStepComplete] = useState(false); const navigate = useNavigate(); const nextStep = () => { - if (index + 1 < target.length) setIndex((prev) => prev + 1); + if (isStepComplete && index + 1 < target.length) { + setIndex((prev) => prev + 1); + setIsStepComplete(false); + } else if (isStepComplete && index + 1 === target.length) { + setIsComplete(true); + } }; const previousStep = () => { @@ -25,10 +31,17 @@ export const useStep = (type: Type) => { }; const currentStep = target[index]; - const totalStep = target.length; return { - nextStep, previousStep, currentStep, index, totalStep, isComplete, setIsComplete, + nextStep, + previousStep, + currentStep, + index, + totalStep, + isComplete, + setIsComplete, + isStepComplete, + setIsStepComplete, }; };