From fa2d4c66a7d3b30ccc2f4e12107fea8c43fc841d Mon Sep 17 00:00:00 2001 From: Nicolas Ettlin Date: Tue, 15 Apr 2025 16:15:08 -0700 Subject: [PATCH] Close the login window when successful --- app/components/ChefSignInPage.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/components/ChefSignInPage.tsx b/app/components/ChefSignInPage.tsx index fec9ade06..f13aa76e1 100644 --- a/app/components/ChefSignInPage.tsx +++ b/app/components/ChefSignInPage.tsx @@ -137,6 +137,13 @@ function OptInsScreen() { [convex], ); + const isLoginSuccessful = optIns.kind === 'loaded' && optIns.optIns.length === 0; + useEffect(() => { + if (isLoginSuccessful) { + window.close(); + } + }, [isLoginSuccessful]); + if (optIns.kind === 'loading') { return ; } @@ -160,7 +167,7 @@ function OptInsScreen() { ); } - if (optIns.kind === 'loaded' && optIns.optIns.length === 0) { + if (isLoginSuccessful) { return (
Done logging in!