From 11bf452706ed70eb2217cbf695820b87a58e963c Mon Sep 17 00:00:00 2001 From: decobot Date: Thu, 14 Nov 2024 14:20:25 -0300 Subject: [PATCH 1/2] fix localstorage logout clear --- components/ui/PrescriberPatientsLive.tsx | 2 +- components/ui/PrescriberSignout.tsx | 1 + components/ui/PrivatePageControl.tsx | 1 + components/ui/Signout.tsx | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/ui/PrescriberPatientsLive.tsx b/components/ui/PrescriberPatientsLive.tsx index 7ee60b7..f01e3f0 100644 --- a/components/ui/PrescriberPatientsLive.tsx +++ b/components/ui/PrescriberPatientsLive.tsx @@ -154,7 +154,7 @@ function PrescriberPatients() { } catch (error) { console.error("Erro ao carregar dados:", error); if (IS_BROWSER) { - localStorage.setItem("AccessToken", ""); + localStorage.setItem("PrescriberAccessToken", ""); } window.location.href = "/"; } diff --git a/components/ui/PrescriberSignout.tsx b/components/ui/PrescriberSignout.tsx index 9cda796..fe0e532 100644 --- a/components/ui/PrescriberSignout.tsx +++ b/components/ui/PrescriberSignout.tsx @@ -25,6 +25,7 @@ function Signout({ redirectTo = "/" }) { }); if (IS_BROWSER) { localStorage.setItem("PrescriberAccessToken", ""); + localStorage.clear(); } window.location.href = redirectTo; } catch (e) { diff --git a/components/ui/PrivatePageControl.tsx b/components/ui/PrivatePageControl.tsx index f5d7586..9fbadaa 100644 --- a/components/ui/PrivatePageControl.tsx +++ b/components/ui/PrivatePageControl.tsx @@ -109,6 +109,7 @@ function PrivatePageControl(_props: Props) { console.error("Erro ao carregar dados:", error); if (IS_BROWSER) { localStorage.setItem("AccessToken", ""); + localStorage.clear(); } window.location.href = "/"; } diff --git a/components/ui/Signout.tsx b/components/ui/Signout.tsx index 6d30c81..2357548 100644 --- a/components/ui/Signout.tsx +++ b/components/ui/Signout.tsx @@ -27,6 +27,7 @@ function Signout(_props: Props) { if (IS_BROWSER) { localStorage.setItem("AccessToken", ""); localStorage.setItem("currentPatientPlan", ""); + localStorage.clear(); } window.location.href = "/"; } catch (e) { From 660f80062582bcb82368f1b9d5b9d7bc75051afc Mon Sep 17 00:00:00 2001 From: decobot Date: Thu, 14 Nov 2024 17:47:33 -0300 Subject: [PATCH 2/2] card associated benefits club --- components/ui/PrivatePageControl.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ui/PrivatePageControl.tsx b/components/ui/PrivatePageControl.tsx index 9fbadaa..b6410d4 100644 --- a/components/ui/PrivatePageControl.tsx +++ b/components/ui/PrivatePageControl.tsx @@ -93,7 +93,7 @@ function PrivatePageControl(_props: Props) { window.location.href = r.dataProfile.lecoupon_smartLink; } else if ( window.location.pathname === "/clube-de-beneficios" && - currentPlan === "CARD_PARTNER" && + ["CARD_PARTNER", "CARD_ASSOCIATED"].includes(currentPlan) && r.dataProfile.lecoupon_free_month_date && r.dataProfile.lecoupon_smartLink ) {