From df28775be7c4781693dd37044f474625f684db95 Mon Sep 17 00:00:00 2001 From: Urvish Date: Mon, 16 Nov 2026 14:28:01 +0530 Subject: [PATCH 1/2] fix(auth): prevent login modal popup on authenticated mobile redirect and startup --- src/App.tsx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index af1024d..9c3c23f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -259,17 +259,20 @@ export default function App() { setAppScheme(urlScheme); } - let activeToken = userToken; + let activeToken = urlToken || localStorage.getItem('access_token'); if (urlToken) { localStorage.setItem('access_token', urlToken); setUserToken(urlToken); - activeToken = urlToken; fetchUserProfile(urlToken); + setShowAuthModal(false); + } else if (activeToken) { + fetchUserProfile(activeToken); } if (urlPlanCode) { - const targetModule = curriculumModules.find(m => m.code === urlPlanCode); + const normalizedPlanCode = urlPlanCode.trim().toUpperCase(); + const targetModule = curriculumModules.find(m => m.code.toUpperCase() === normalizedPlanCode); if (targetModule) { setCart([targetModule]); setShowLockedByCategory(prev => ({ @@ -297,16 +300,7 @@ export default function App() { fetchPublicPlans(); fetchModuleCategories(); - - if (activeToken && !urlToken) { - fetchUserProfile(activeToken); - } - - if (!activeToken && !urlToken) { - setAuthMode('login'); - setShowAuthModal(true); - } - }, [userToken]); + }, []); // Recalculate price whenever cart, coupon, currency, or logged-in user changes useEffect(() => { From 36a530b8d7aecdbae2569efb0c50691921a41c38 Mon Sep 17 00:00:00 2001 From: Urvish Date: Mon, 16 Nov 2026 15:22:19 +0530 Subject: [PATCH 2/2] fix(checkout): validate and display duplicate mobile number errors in billing phone modal --- src/App.tsx | 5 +++-- src/components/checkout/BillingPhoneModal.tsx | 13 +++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index af1024d..2d26b5f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -438,8 +438,9 @@ export default function App() { } return false; } catch (err: any) { - alert(err.response?.data?.detail || 'Failed to save billing phone number.'); - return false; + const errorMsg = err.response?.data?.detail || 'Failed to save billing phone number.'; + alert(errorMsg); + throw new Error(errorMsg); } }; diff --git a/src/components/checkout/BillingPhoneModal.tsx b/src/components/checkout/BillingPhoneModal.tsx index db4637a..d0e2418 100644 --- a/src/components/checkout/BillingPhoneModal.tsx +++ b/src/components/checkout/BillingPhoneModal.tsx @@ -54,10 +54,15 @@ export const BillingPhoneModal: React.FC = ({ setSaving(true); const e164 = formatE164Phone(dialCode, phone); - const success = await onSavePhone(e164, country); - setSaving(false); - if (success) { - onClose(); + try { + const success = await onSavePhone(e164, country); + if (success) { + onClose(); + } + } catch (err: any) { + setError(err?.message || 'Failed to save billing phone number.'); + } finally { + setSaving(false); } };