diff --git a/web/src/components/Auth/EmailPassword/EmailPasswordSignupForm.tsx b/web/src/components/Auth/EmailPassword/EmailPasswordSignupForm.tsx index 290afea50..630b75122 100644 --- a/web/src/components/Auth/EmailPassword/EmailPasswordSignupForm.tsx +++ b/web/src/components/Auth/EmailPassword/EmailPasswordSignupForm.tsx @@ -1,5 +1,6 @@ import { CircularProgress } from "@mui/material"; import { useState } from "react"; +import { useDispatch } from "react-redux"; import CustomButton from "../../common/CustomButton/index.tsx"; import { Toast } from "../../Toast.tsx"; import { useNavigate } from "react-router-dom"; @@ -10,9 +11,12 @@ import { import CustomInput from "../../Inputs/CustomInput.tsx"; import { InputTypes } from "../../../types/inputs/inputTypes.ts"; import ShowPasswordIcon from "./ShowPasswordIcon.tsx"; +import { setCommonKey } from "../../../store/features/common/commonSlice.ts"; function EmailPasswordSignupForm() { const navigate = useNavigate(); + const dispatch = useDispatch(); + const [error, setError] = useState(""); const [btnLoading, setBtnLoading] = useState(false); const [triggerSignup, { isLoading }] = useSignupMutation(); @@ -36,6 +40,15 @@ function EmailPasswordSignupForm() { navigate("/login"); } + function deleteLastLogin() { + localStorage.removeItem("last_login") + + dispatch(setCommonKey({ + key: "productUpdateStatus", + value : false } + )); + } + const getError = (err) => { const errObj = err?.data; if (errObj && Object.keys(errObj).length !== 0) { @@ -66,6 +79,7 @@ function EmailPasswordSignupForm() { setPassword(""); setFirstName(""); setLastName(""); + deleteLastLogin(); redirectToLoginAfterSignup(); } catch (err) { diff --git a/web/src/components/Modals/RecieveUpdatesModal/index.tsx b/web/src/components/Modals/RecieveUpdatesModal/index.tsx index a4b4e76b2..84093c512 100644 --- a/web/src/components/Modals/RecieveUpdatesModal/index.tsx +++ b/web/src/components/Modals/RecieveUpdatesModal/index.tsx @@ -1,20 +1,24 @@ import React, { useEffect } from "react"; +import { useDispatch } from "react-redux"; import Overlay from "../../Overlay/index.tsx"; import { CloseRounded } from "@mui/icons-material"; import CustomButton from "../../common/CustomButton/index.tsx"; import posthog from "posthog-js"; +import { setCommonKey } from "../../../store/features/common/commonSlice.ts"; const RecieveUpdatesModal = ({ isOpen, close }) => { - const handleYes = () => { - posthog.capture("POST_LOGIN_SUBSCRIPTION_UPDATE_INTERACTED", { - subscription_requested: true, - }); - close(); - }; + const dispatch = useDispatch(); + + const handleProductUpdateSignup = (signupStatus: boolean) => { + dispatch( + setCommonKey({ + key: "productUpdateStatus", + value: true, + }), + ); - const handleNo = () => { posthog.capture("POST_LOGIN_SUBSCRIPTION_UPDATE_INTERACTED", { - subscription_requested: false, + subscription_requested: signupStatus, }); close(); }; @@ -27,10 +31,14 @@ const RecieveUpdatesModal = ({ isOpen, close }) => { return (