diff --git a/autogpt_platform/frontend/src/app/(platform)/login/useLoginPage.ts b/autogpt_platform/frontend/src/app/(platform)/login/useLoginPage.ts index 8eea6752a5..a1e8b5a92c 100644 --- a/autogpt_platform/frontend/src/app/(platform)/login/useLoginPage.ts +++ b/autogpt_platform/frontend/src/app/(platform)/login/useLoginPage.ts @@ -62,6 +62,9 @@ export function useLoginPage() { } async function handleLogin(data: z.infer) { + setIsLoading(true); + setIsLoggingIn(true); + if (data.email.includes("@agpt.co")) { toast({ title: "Please use Google SSO to login using an AutoGPT email.", @@ -73,8 +76,6 @@ export function useLoginPage() { return; } - setIsLoggingIn(true); - try { const result = await loginAction(data.email, data.password); diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountLogoutOption.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountLogoutOption.tsx index c462e1c6ac..ec6f65d0a6 100644 --- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountLogoutOption.tsx +++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountLogoutOption.tsx @@ -1,43 +1,45 @@ "use client"; import { IconLogOut } from "@/components/__legacy__/ui/icons"; import { LoadingSpinner } from "@/components/__legacy__/ui/loading"; -import { toast } from "@/components/molecules/Toast/use-toast"; +import { useToast } from "@/components/molecules/Toast/use-toast"; import { useSupabase } from "@/lib/supabase/hooks/useSupabase"; import { cn } from "@/lib/utils"; import * as Sentry from "@sentry/nextjs"; -import { useTransition } from "react"; +import { useState } from "react"; export function AccountLogoutOption() { - const [isPending, startTransition] = useTransition(); + const [isLoggingOut, setIsLoggingOut] = useState(false); const supabase = useSupabase(); + const { toast } = useToast(); - function handleLogout() { - startTransition(async () => { - try { - await supabase.logOut(); - } catch (e) { - Sentry.captureException(e); - toast({ - title: "Error logging out", - description: - "Something went wrong when logging out. Please try again. If the problem persists, please contact support.", - variant: "destructive", - }); - } - }); + async function handleLogout() { + setIsLoggingOut(true); + try { + await supabase.logOut(); + } catch (e) { + Sentry.captureException(e); + toast({ + title: "Error logging out", + description: + "Something went wrong when logging out. Please try again. If the problem persists, please contact support.", + variant: "destructive", + }); + } finally { + setIsLoggingOut(false); + } } return (
- {isPending ? ( + {isLoggingOut ? ( ) : ( <>