From f3a56348c155630afb17c1face5a7dd8e126d0b1 Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Thu, 9 May 2024 17:34:10 +0300 Subject: [PATCH] feat: update user ga events --- src/store/useUser.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/store/useUser.ts b/src/store/useUser.ts index d2afbe9..5cece38 100644 --- a/src/store/useUser.ts +++ b/src/store/useUser.ts @@ -27,7 +27,14 @@ const useUser = create()(set => ({ }, logout: async () => { toast.loading("Logging out...", { id: "logout" }); - await supabase.auth.signOut(); + + const { error } = await supabase.auth.signOut({ scope: "local" }); + if (error) { + toast.error("Failed to log out."); + return; + } + + gaEvent("engagement", "logout"); set(initialStates); toast.success("Logged out.", { id: "logout" }); },