@@ -127,23 +127,11 @@ const EnrollProfileCompletionInner = () => {
127127 localStorage . removeItem ( 'previousTenantId' ) ;
128128
129129 // Store landing page for later navigation
130- const finalLandingPage = landingPage || '/home' ;
131- setLandingPage ( finalLandingPage ) ;
132-
133- // Check if isForNavaPatham is true, skip popup and directly trigger start learning action
134- const isForNavaPatham =
135- typeof window !== 'undefined'
136- ? localStorage . getItem ( 'isForNavaPatham' ) === 'true'
137- : false ;
138-
139- if ( isForNavaPatham ) {
140- // Skip popup and directly trigger start learning action
141- onSigin ( finalLandingPage ) ;
142- } else {
143- // Show success modal instead of redirecting immediately
144- setSignupSuccessModal ( true ) ;
145- }
146- }
130+ setLandingPage ( landingPage || '/home' ) ;
131+
132+ // Show success modal instead of redirecting immediately
133+ setSignupSuccessModal ( true ) ;
134+ }
147135 } catch ( error ) {
148136 console . error ( 'Failed to access program:' , error ) ;
149137 router . push ( '/programs' ) ;
@@ -154,36 +142,35 @@ const EnrollProfileCompletionInner = () => {
154142 setSignupSuccessModal ( false ) ;
155143 } ;
156144
157- const onSigin = ( customLandingPage ?: string ) => {
145+ const onSigin = ( ) => {
158146 setSignupSuccessModal ( false ) ;
159147 console . log ( 'enroll user to tenant' , localStorage . getItem ( 'tenantId' ) ) ;
160- const targetLandingPage = customLandingPage || landingPage || '/home' ;
148+ if ( localStorage . getItem ( 'isAndroidApp' ) == 'yes' )
149+ {
150+ // Send message to React Native WebView
161151
162- if ( localStorage . getItem ( 'isAndroidApp' ) == 'yes' ) {
163- // Send message to React Native WebView
152+ // const enrolledProgramData = localStorage.getItem('enrolledProgramData');
164153
165- // const enrolledProgramData = localStorage.getItem(' enrolledProgramData');
154+ // const program = JSON.parse( enrolledProgramData || '{} ');
166155
167- // const program = JSON.parse(enrolledProgramData || '{}');
168156
169- if ( window . ReactNativeWebView ) {
170- window . ReactNativeWebView . postMessage (
171- JSON . stringify ( {
172- type : 'ENROLL_PROGRAM_EVENT' , // Event type identifier
173- data : {
174- userId : localStorage . getItem ( 'userId' ) ,
175- tenantId : localStorage . getItem ( 'tenantId' ) ,
176- token : localStorage . getItem ( 'token' ) ,
177- refreshToken : localStorage . getItem ( 'refreshTokenForAndroid' ) ,
157+ if ( window . ReactNativeWebView ) {
158+ window . ReactNativeWebView . postMessage ( JSON . stringify ( {
159+ type : 'ENROLL_PROGRAM_EVENT' , // Event type identifier
160+ data : {
161+ userId : localStorage . getItem ( 'userId' ) ,
162+ tenantId : localStorage . getItem ( 'tenantId' ) ,
163+ token : localStorage . getItem ( 'token' ) ,
164+ refreshToken : localStorage . getItem ( 'refreshTokenForAndroid' ) ,
178165
179- // Add any data you want to send
180- } ,
181- } )
182- ) ;
166+ // Add any data you want to send
167+ }
168+ } ) ) ;
169+ }
183170 }
184- } else {
185- localStorage . removeItem ( 'enrollTenantId' ) ;
186- router . push ( targetLandingPage ) ;
171+ else {
172+ localStorage . removeItem ( 'enrollTenantId' )
173+ router . push ( landingPage || '/home' ) ;
187174 }
188175 // Navigate to landing page
189176 } ;
0 commit comments