diff --git a/src/pages/SignUp/MoreInfo/index.tsx b/src/pages/SignUp/MoreInfo/index.tsx index a01e597..e9bd303 100644 --- a/src/pages/SignUp/MoreInfo/index.tsx +++ b/src/pages/SignUp/MoreInfo/index.tsx @@ -8,7 +8,7 @@ import ButtonActive from "../../../components/ButtonActive"; interface Props { userInfo: any; setUserInfo: React.Dispatch>; - onNext: () => void; + onNext: (updates: { mainPhotographyTypes: string[]; activeRegions: string[] }) => void; } export default function MoreInfo({ @@ -33,12 +33,7 @@ export default function MoreInfo({ }, [userInfo, mainPhotographyTypes, locs]); const handleNext = () => { - setUserInfo({ - ...userInfo, - mainPhotographyTypes, - activeRegions: locs, - }); - onNext(); + onNext({ mainPhotographyTypes, activeRegions: locs }); }; return ( diff --git a/src/pages/SignUp/index.tsx b/src/pages/SignUp/index.tsx index 771235d..dbb3d7a 100644 --- a/src/pages/SignUp/index.tsx +++ b/src/pages/SignUp/index.tsx @@ -22,7 +22,7 @@ export default function SignUp() { instagramId: null, profileImage: { name: "", url: "" }, mainPhotographyTypes: [""], - activeRegions: [], + activeRegions: [] as string[], }); const handleRoleSelect = (selectedRole: string) => { @@ -30,8 +30,11 @@ export default function SignUp() { setStep(step + 1); }; - const goToNextStep = () => { - setStep(step + 1); + const goToNextStep = (updates?: { mainPhotographyTypes?: string[]; activeRegions?: string[] }) => { + if (updates) { + setUserInfo((prev) => ({ ...prev, ...updates })); + } + setStep((prev) => prev + 1); }; const handleSignUp = () => {