From 85161a741bab77b826c6ac4a55a4d345acd2a891 Mon Sep 17 00:00:00 2001 From: Nathanael Liu Date: Fri, 12 Apr 2024 04:06:26 +0000 Subject: [PATCH] fix: update default screen --- apps/masterbots.ai/components/layout/user-menu.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/masterbots.ai/components/layout/user-menu.tsx b/apps/masterbots.ai/components/layout/user-menu.tsx index f24b9f10..b197bc85 100644 --- a/apps/masterbots.ai/components/layout/user-menu.tsx +++ b/apps/masterbots.ai/components/layout/user-menu.tsx @@ -1,6 +1,7 @@ 'use client' import Image from 'next/image' +import { useRouter } from 'next/navigation' import { Button } from '@/components/ui/button' import { DropdownMenu, @@ -16,8 +17,16 @@ import { useGlobalStore } from '@/hooks/use-global-store' export function UserMenu() { const supabase = useSupabaseClient() const { user } = useGlobalStore() + const router = useRouter() - const signout = () => supabase.auth.signOut() + const signout = async () => { + const { error } = await supabase.auth.signOut() + if (error) { + console.error('ERROR:', error) + } + router.push('/') + router.refresh() + } return (