Skip to content

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

fix: redirect to sign-in issue

Jonathan Summers-Muirb1715babb097
diff --git a/studio/hooks/misc/withAuth.tsx b/studio/hooks/misc/withAuth.tsx
index 787b0ab730e..1949b763fd4 100644
--- a/studio/hooks/misc/withAuth.tsx
+++ b/studio/hooks/misc/withAuth.tsx
@@ -28,6 +28,7 @@ export function withAuth<T>(
) {
const WithAuthHOC: ComponentType<T> = (props: any) => {
const router = useRouter()
+ const { basePath } = router
const { ref, slug } = useParams()
const rootStore = useStore()
const { isLoading, session } = useAuth()
@@ -87,7 +88,7 @@ export function withAuth<T>(
{IS_PLATFORM && (
<script
dangerouslySetInnerHTML={{
- __html: `window._getReturnToPath = ${getReturnToPath.toString()};if (!localStorage.getItem('${STORAGE_KEY}') && !location.hash) {const searchParams = new URLSearchParams(location.search);searchParams.set('returnTo', location.pathname);location.replace('/sign-in' + '?' + searchParams.toString())}`,
+ __html: `window._getReturnToPath = ${getReturnToPath.toString()};if (!localStorage.getItem('${STORAGE_KEY}') && !location.hash) {const searchParams = new URLSearchParams(location.search);searchParams.set('returnTo', location.pathname);location.replace('${basePath}/sign-in' + '?' + searchParams.toString())}`,
}}
/>
)}
@@ -107,7 +108,8 @@ export function withAuth<T>(
}
function defaultRedirectTo(ref: string | string[] | undefined) {
- return IS_PLATFORM ? '/sign-in' : ref !== undefined ? `/project/${ref}` : '/projects'
+ const { basePath } = useRouter()
+ return IS_PLATFORM ? `/sign-in` : ref !== undefined ? `/project/${ref}` : '/projects'
}
function checkRedirectTo(