@@ -12,10 +12,9 @@ import { Stepper } from "@/components/common/Stepper";
1212import { GoogleStep } from "./steps/GoogleStep" ;
1313import { ProfileStep } from "./steps/ProfileStep" ;
1414import { EmailStep } from "./steps/EmailStep" ;
15- import { TrackStep } from "./steps/TrackStep" ;
1615import { useRegister } from "@/hooks/use-auth" ;
1716
18- const STEPS = [ "Google 인증" , "정보 입력" , "이메일 인증" , "트랙 선택" ] ;
17+ const STEPS = [ "Google 인증" , "정보 입력" , "이메일 인증" ] ;
1918
2019interface WizardState {
2120 step : number ;
@@ -27,14 +26,12 @@ interface WizardState {
2726 phone : string ;
2827 grade : string ;
2928 schoolEmail : string ;
30- track : string ;
3129}
3230
3331type WizardAction =
3432 | { type : "SET_GOOGLE" ; googleToken : string ; googleName : string }
3533 | { type : "SET_PROFILE" ; name : string ; department : string ; studentId : string ; phone : string ; grade : string }
3634 | { type : "SET_EMAIL" ; schoolEmail : string }
37- | { type : "SET_TRACK" ; track : string }
3835 | { type : "GO_BACK" } ;
3936
4037function decodeGoogleName ( token : string ) : string {
@@ -60,16 +57,15 @@ function reducer(state: WizardState, action: WizardAction): WizardState {
6057 case "SET_PROFILE" :
6158 return { ...state , step : 3 , name : action . name , department : action . department , studentId : action . studentId , phone : action . phone , grade : action . grade } ;
6259 case "SET_EMAIL" :
63- return { ...state , step : 4 , schoolEmail : action . schoolEmail } ;
64- case "SET_TRACK" :
65- return { ...state , track : action . track } ;
60+ return { ...state , schoolEmail : action . schoolEmail } ;
6661 case "GO_BACK" :
6762 return { ...state , step : Math . max ( 1 , state . step - 1 ) } ;
6863 }
6964}
7065
7166export function RegisterPage ( ) {
7267 const location = useLocation ( ) ;
68+ const navigate = useNavigate ( ) ;
7369 const initialGoogleToken =
7470 ( location . state as { googleToken ?: string } ) ?. googleToken ?? "" ;
7571
@@ -85,23 +81,20 @@ export function RegisterPage() {
8581 phone : "" ,
8682 grade : "" ,
8783 schoolEmail : "" ,
88- track : "" ,
8984 } ) ;
9085
9186 const register = useRegister ( ) ;
92- const navigate = useNavigate ( ) ;
9387
94- const handleTrackComplete = async ( track : string ) => {
95- dispatch ( { type : "SET_TRACK " , track } ) ;
88+ const handleEmailComplete = async ( email : string ) => {
89+ dispatch ( { type : "SET_EMAIL " , schoolEmail : email } ) ;
9690 try {
9791 await register . mutateAsync ( {
9892 google_token : state . googleToken ,
9993 name : state . name ,
10094 department : state . department ,
10195 student_id : state . studentId ,
102- school_email : state . schoolEmail ,
96+ school_email : email ,
10397 phone : state . phone ,
104- track,
10598 grade : state . grade ,
10699 } ) ;
107100 navigate ( "/post-register" , { state : { grade : state . grade } } ) ;
@@ -148,16 +141,7 @@ export function RegisterPage() {
148141 { state . step === 3 && (
149142 < EmailStep
150143 onBack = { ( ) => dispatch ( { type : "GO_BACK" } ) }
151- onComplete = { ( email ) =>
152- dispatch ( { type : "SET_EMAIL" , schoolEmail : email } )
153- }
154- />
155- ) }
156- { state . step === 4 && (
157- < TrackStep
158- onBack = { ( ) => dispatch ( { type : "GO_BACK" } ) }
159- onComplete = { handleTrackComplete }
160- isPending = { register . isPending }
144+ onComplete = { handleEmailComplete }
161145 />
162146 ) }
163147 </ CardContent >
0 commit comments