From 0f2aab484606924634a1c45d31299cf94828c042 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Mon, 8 Apr 2024 21:25:37 +0530 Subject: [PATCH] =?UTF-8?q?Show=20the=20popup=20if=20the=20existing=20user?= =?UTF-8?q?s=20has=20not=20accepted=20the=20toc=20and=20mar=E2=80=A6=20(#3?= =?UTF-8?q?01)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/client/App.tsx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/app/src/client/App.tsx b/app/src/client/App.tsx index f187c3f..7f4496e 100644 --- a/app/src/client/App.tsx +++ b/app/src/client/App.tsx @@ -57,19 +57,26 @@ export default function App({ children }: { children: ReactNode }) { useEffect(() => { if (user) { if (!user.isSignUpComplete) { - const hasAcceptedTos = - localStorage.getItem('hasAcceptedTos') === 'true'; - const hasSubscribedToMarketingEmails = - localStorage.getItem('hasSubscribedToMarketingEmails') === 'true'; - if (!hasAcceptedTos || !hasSubscribedToMarketingEmails) { - setShowTosAndMarketingEmailsModal(true); - } else { + if (user.hasAcceptedTos && user.hasSubscribedToMarketingEmails) { updateCurrentUser({ isSignUpComplete: true, - hasAcceptedTos: true, - hasSubscribedToMarketingEmails: true, }); setShowTosAndMarketingEmailsModal(false); + } else { + const hasAcceptedTos = + localStorage.getItem('hasAcceptedTos') === 'true'; + const hasSubscribedToMarketingEmails = + localStorage.getItem('hasSubscribedToMarketingEmails') === 'true'; + if (!hasAcceptedTos || !hasSubscribedToMarketingEmails) { + setShowTosAndMarketingEmailsModal(true); + } else { + updateCurrentUser({ + isSignUpComplete: true, + hasAcceptedTos: true, + hasSubscribedToMarketingEmails: true, + }); + setShowTosAndMarketingEmailsModal(false); + } } } else { setShowTosAndMarketingEmailsModal(false);