Skip to content

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

fix: default redirectTo

phamhieu163e78a3c3db
diff --git a/studio/hooks/misc/withAuth.tsx b/studio/hooks/misc/withAuth.tsx
index a0571bc07ad..680c4c34cb1 100644
--- a/studio/hooks/misc/withAuth.tsx
+++ b/studio/hooks/misc/withAuth.tsx
@@ -24,7 +24,7 @@ export function withAuth(
const { app, ui } = rootStore
const page = router.pathname.split('/')[3]
- const redirectTo = options?.redirectTo ?? (!isUndefined(ref) ? `/project/${ref}` : '/')
+ const redirectTo = options?.redirectTo ?? defaultRedirectTo(ref)
const redirectIfFound = options?.redirectIfFound
const returning =
@@ -75,6 +75,10 @@ export function withAuth(
}
}
+function defaultRedirectTo(ref: string | string[] | undefined) {
+ return IS_PLATFORM ? '/' : !isUndefined(ref) ? `/project/${ref}` : '/'
+}
+
function checkRedirectTo(
loading: boolean,
router: NextRouter,