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.es.js CHANGED
@@ -2816,14 +2816,21 @@ const handleRedirection = (type, source) => {
2816
2816
  }
2817
2817
  };
2818
2818
  const CookiesUtil = {
2819
+ COOKIE_OPTIONS: {
2820
+ path: "/",
2821
+ domain: DEV ? "localhost" : ".6seconds.org",
2822
+ secure: true,
2823
+ sameSite: "None",
2824
+ expires: 7
2825
+ },
2826
+ get: (name) => {
2827
+ return JSON.parse(Cookies.get(name) || "{}");
2828
+ },
2819
2829
  set: (name, val) => {
2820
- Cookies.set(name, JSON.stringify(val), {
2821
- path: "/",
2822
- domain: DEV ? "localhost" : ".6seconds.org",
2823
- secure: true,
2824
- sameSite: "None",
2825
- expires: 7
2826
- });
2830
+ Cookies.set(name, JSON.stringify(val), CookiesUtil.COOKIE_OPTIONS);
2831
+ },
2832
+ remove: (name) => {
2833
+ Cookies.remove(name, CookiesUtil.COOKIE_OPTIONS);
2827
2834
  }
2828
2835
  };
2829
2836
  //! moment.js
@@ -10749,12 +10756,13 @@ const IMAGES = {
10749
10756
  Us
10750
10757
  };
10751
10758
  const PreviousLoginBanner = ({ t: t2, router }) => {
10752
- const previousLoginDetails = Cookies.get("previousLoginDetails") || {};
10759
+ const previousLoginDetails = CookiesUtil.get("previousLoginDetails") || {};
10753
10760
  CookiesUtil.set("previousLoginDetails", previousLoginDetails);
10754
10761
  const handleAutoLogin = async () => {
10755
10762
  try {
10756
10763
  const res = await autoLoginApi(previousLoginDetails?.id);
10757
10764
  if (res.remote === "success") {
10765
+ CookiesUtil.remove("previousLoginDetails");
10758
10766
  if (router) {
10759
10767
  router.reload();
10760
10768
  router.replace(ROUTES.home);
@@ -10762,7 +10770,6 @@ const PreviousLoginBanner = ({ t: t2, router }) => {
10762
10770
  window.location.reload();
10763
10771
  window.location.href = ROUTES.home;
10764
10772
  }
10765
- Cookies.remove("previousLoginDetails");
10766
10773
  }
10767
10774
  } catch (err) {
10768
10775
  toast.error(t2(ALERT_MESSAGES.fallbackError));