Skip to content

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

Remove use of process env in getReturnToPath

Joshen Lim12bf2e6b0222
diff --git a/studio/lib/gotrue.ts b/studio/lib/gotrue.ts
index f634c1aa881..8fb024e9dba 100644
--- a/studio/lib/gotrue.ts
+++ b/studio/lib/gotrue.ts
@@ -34,19 +34,15 @@ export const getIdentity = (gotrueUser: User) => {
}
}
-// NOTE: do not use any imports in this function,
-// as it is used standalone in the documents head
+// NOTE: do not use any imports in this function as it is used standalone in the documents head
+// [Joshen] Potentially can remove after full move over to /dashboard
export const getReturnToPath = (fallback = '/projects') => {
const searchParams = new URLSearchParams(location.search)
- let returnTo = searchParams.get('returnTo') ?? fallback
-
- /**
- * remove base path value ("/dashboard") from returnTo
- */
- returnTo =
- returnTo && process?.env?.NEXT_PUBLIC_BASE_PATH
- ? returnTo.replace(process.env.NEXT_PUBLIC_BASE_PATH, '')
- : returnTo
+
+ // [Joshen] Remove base path value ("/dashboard") from returnTo
+ // because we're having this in the document's head, we won't have access
+ // to process.env, hardcoding the value as a workaround
+ const returnTo = (searchParams.get('returnTo') ?? fallback).replace('/dashboard', '')
searchParams.delete('returnTo')