Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add log out route (#32820)

Joshen Lim9ed9938fe093
diff --git a/apps/studio/pages/logout.tsx b/apps/studio/pages/logout.tsx
new file mode 100644
index 00000000000..40307dd9275
--- /dev/null
+++ b/apps/studio/pages/logout.tsx
@@ -0,0 +1,29 @@
+import { useRouter } from 'next/router'
+import { useEffect } from 'react'
+import { toast } from 'sonner'
+
+import { Loading } from 'components/ui/Loading'
+import { useSignOut } from 'lib/auth'
+import { NextPageWithLayout } from 'types'
+
+const LogoutPage: NextPageWithLayout = () => {
+ const router = useRouter()
+ const signOut = useSignOut()
+
+ useEffect(() => {
+ const logout = async () => {
+ await signOut()
+ toast('Successfully logged out')
+ await router.push('/sign-in')
+ }
+ logout()
+ }, [])
+
+ return (
+ <div className="w-full h-screen flex items-center justify-center">
+ <Loading />
+ </div>
+ )
+}
+
+export default LogoutPage