22
33export const dynamic = 'force-dynamic' ;
44
5- import { useGetNickname , usePostOnboardingData } from '@apis/user' ;
5+ import { usePostOnboardingData } from '@apis/user' ;
66import { OnboardingDataV2 } from '@apis/user/type' ;
77import ProgressBar from '@components/common/progressBar/ProgressBar' ;
8- import ExceptLayout from '@components/except/exceptLayout/ExceptLayout' ;
98import OnboardingSection from '@components/onboarding/OnboardingSection' ;
109import { ONBOARDING_STEPS , COMMON_DESCRIPTION } from '@constants/onboarding/onboardingSteps' ;
1110import useFunnel from '@hooks/useFunnel' ;
1211import { getStorageValue } from '@hooks/useLocalStorage' ;
1312import React , { useState , useEffect } from 'react' ;
13+ import { getCookie } from 'cookies-next' ;
1414import useEventLogger from 'src/gtm/hooks/useEventLogger' ;
1515
1616import container from './onboardingPage.css' ;
1717
1818const OnboardingPage = ( ) => {
19+ const [ userName , setUserName ] = useState ( '' ) ;
20+
21+ useEffect ( ( ) => {
22+ const name = getCookie ( 'userNickname' ) ;
23+ if ( typeof name === 'string' ) {
24+ setUserName ( name ) ;
25+ }
26+ } , [ ] ) ;
27+
1928 const { Funnel, Step, nextStep, prevStep, currentStep } = useFunnel (
2029 ONBOARDING_STEPS . map ( ( step ) => step . id ) ,
2130 '/welcome' ,
@@ -33,7 +42,6 @@ const OnboardingPage = () => {
3342 const userId = Number ( getStorageValue ( 'userId' ) ) ;
3443 const { mutate : postOnboardingMutate } = usePostOnboardingData ( ) ;
3544
36- const { data, isLoading } = useGetNickname ( userId ) ;
3745 const [ isInitialLoad , setIsInitialLoad ] = useState < boolean > ( true ) ;
3846 const setVh = ( ) => {
3947 const vh = window . innerHeight * 0.01 ;
@@ -85,10 +93,6 @@ const OnboardingPage = () => {
8593 } ) ;
8694 } ;
8795
88- if ( isLoading ) {
89- return < ExceptLayout type = "loading" /> ;
90- }
91-
9296 return (
9397 < div className = { container } >
9498 < ProgressBar
@@ -102,9 +106,7 @@ const OnboardingPage = () => {
102106 < Step key = { id } name = { id } >
103107 < OnboardingSection
104108 id = { id }
105- title = {
106- id === 'ageRange' || id === 'gender' ? [ `${ data ?. nickname } 님의` , title ] : title
107- }
109+ title = { id === 'ageRange' || id === 'gender' ? [ `${ userName } 님의` , title ] : title }
108110 description = { COMMON_DESCRIPTION }
109111 options = { options }
110112 isNextDisabledInitially = { isNextDisabledInitially || false }
0 commit comments