sixseconds-modules 1.6.39 → 1.6.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -2834,14 +2834,21 @@ const handleRedirection = (type, source) => {
2834
2834
  }
2835
2835
  };
2836
2836
  const CookiesUtil = {
2837
+ COOKIE_OPTIONS: {
2838
+ path: "/",
2839
+ domain: DEV ? "localhost" : ".6seconds.org",
2840
+ secure: true,
2841
+ sameSite: "None",
2842
+ expires: 7
2843
+ },
2844
+ get: (name) => {
2845
+ return JSON.parse(Cookies.get(name) || "{}");
2846
+ },
2837
2847
  set: (name, val) => {
2838
- Cookies.set(name, JSON.stringify(val), {
2839
- path: "/",
2840
- domain: DEV ? "localhost" : ".6seconds.org",
2841
- secure: true,
2842
- sameSite: "None",
2843
- expires: 7
2844
- });
2848
+ Cookies.set(name, JSON.stringify(val), CookiesUtil.COOKIE_OPTIONS);
2849
+ },
2850
+ remove: (name) => {
2851
+ Cookies.remove(name, CookiesUtil.COOKIE_OPTIONS);
2845
2852
  }
2846
2853
  };
2847
2854
  //! moment.js
@@ -10767,12 +10774,13 @@ const IMAGES = {
10767
10774
  Us
10768
10775
  };
10769
10776
  const PreviousLoginBanner = ({ t: t2, router }) => {
10770
- const previousLoginDetails = Cookies.get("previousLoginDetails") || {};
10777
+ const previousLoginDetails = CookiesUtil.get("previousLoginDetails") || {};
10771
10778
  CookiesUtil.set("previousLoginDetails", previousLoginDetails);
10772
10779
  const handleAutoLogin = async () => {
10773
10780
  try {
10774
10781
  const res = await autoLoginApi(previousLoginDetails?.id);
10775
10782
  if (res.remote === "success") {
10783
+ CookiesUtil.remove("previousLoginDetails");
10776
10784
  if (router) {
10777
10785
  router.reload();
10778
10786
  router.replace(ROUTES.home);
@@ -10780,7 +10788,6 @@ const PreviousLoginBanner = ({ t: t2, router }) => {
10780
10788
  window.location.reload();
10781
10789
  window.location.href = ROUTES.home;
10782
10790
  }
10783
- Cookies.remove("previousLoginDetails");
10784
10791
  }
10785
10792
  } catch (err) {
10786
10793
  toast.error(t2(ALERT_MESSAGES.fallbackError));