Skip to content

Commit

Permalink
Show the popup if the existing users has not accepted the toc and mar… (
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj authored Apr 8, 2024
1 parent df80d1f commit 0f2aab4
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions app/src/client/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0f2aab4

Please sign in to comment.