@@ -22,29 +22,21 @@ import {
2222} from '@/components/ui/design-system'
2323import { interestOptions } from '@/constant/interestOptions'
2424import { wishOptions } from '@/constant/wishOptions'
25- import { formatRecruitData } from '@/utils/formatRecruitData'
2625import { formatDateInput } from '@/utils/date'
2726import { usePhoneNumber } from '@/hooks/usePhoneNumber'
2827
2928type RecruitFormState = {
30- privacyAgreement : boolean
3129 name : string
3230 gender : string
3331 birth : string
3432 major : string
3533 enrolledClassification : string
36- grade : string
3734 studentId : string
3835 phoneNumber : string
39- nationality : string
4036 emailLocal : string
4137 emailDomain : string
4238 gdgInterest : string [ ]
4339 gdgWish : string [ ]
44- gdgPeriod : string [ ]
45- gdgRoute : string
46- gdgRouteEtc : string
47- gdgExpect : string [ ]
4840 gdgFeedback : string
4941 isPayed : boolean
5042 proofFile : File | null
@@ -60,24 +52,17 @@ interface DuplicateCheckState {
6052}
6153
6254const initialFormState : RecruitFormState = {
63- privacyAgreement : false ,
6455 name : '' ,
6556 gender : '' ,
6657 birth : '' ,
6758 major : '' ,
6859 enrolledClassification : '' ,
69- grade : '1학년' ,
7060 studentId : '' ,
7161 phoneNumber : '' ,
72- nationality : '대한민국' ,
7362 emailLocal : '' ,
7463 emailDomain : 'inha.edu' ,
7564 gdgInterest : [ ] ,
7665 gdgWish : [ ] ,
77- gdgPeriod : [ ] ,
78- gdgRoute : '기타' ,
79- gdgRouteEtc : '' ,
80- gdgExpect : [ ] ,
8166 gdgFeedback : '' ,
8267 isPayed : false ,
8368 proofFile : null
@@ -348,26 +333,26 @@ export default function Recruit() {
348333 enrolledClassification : formData . enrolledClassification
349334 } )
350335 map . set ( 3 , {
351- grade : formData . grade ,
352- phoneNumber : toDigits ( formData . phoneNumber ) ,
353- nationality : formData . nationality
336+ phoneNumber : toDigits ( formData . phoneNumber )
354337 } )
355338 map . set ( 4 , {
356339 gender : formData . gender ,
357340 birth : formData . birth ,
358341 email : `${ formData . emailLocal . trim ( ) } @${ formData . emailDomain } `
359342 } )
360343 map . set ( 5 , { major : formData . major } )
344+ map . set ( 8 , { gdgInterest : formData . gdgInterest } )
345+ map . set ( 9 , { gdgWish : formData . gdgWish } )
361346 map . set ( 10 , { gdgFeedback : formData . gdgFeedback } )
362347 map . set ( 11 , { isPayed : formData . isPayed } )
363348 return map
364349 }
365- const formattedData = formatRecruitData ( buildRecruitMap ( ) )
350+ const payload = Object . fromEntries ( buildRecruitMap ( ) )
366351 if ( formData . enrolledClassification === '군휴학' && formData . proofFile ) {
367352 const fd = new FormData ( )
368353 fd . append (
369354 'request' ,
370- new Blob ( [ JSON . stringify ( formattedData ) ] , { type : 'application/json' } )
355+ new Blob ( [ JSON . stringify ( payload ) ] , { type : 'application/json' } )
371356 )
372357 fd . append ( 'file' , formData . proofFile )
373358 await axios . post ( `${ process . env . NEXT_PUBLIC_BASE_API_URL } /recruit/member/apply` , fd , {
@@ -376,7 +361,7 @@ export default function Recruit() {
376361 } else {
377362 await axios . post (
378363 `${ process . env . NEXT_PUBLIC_BASE_API_URL } /recruit/member/apply` ,
379- formattedData
364+ payload
380365 )
381366 }
382367 router . push ( '/recruit/member/completed?from=recruit' )
0 commit comments