The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: add basePath to all login logic
Jonathan Summers-Muir6d58904e674c
diff --git a/studio/components/interfaces/SignIn/ForgotPasswordForm.tsx b/studio/components/interfaces/SignIn/ForgotPasswordForm.tsxindex e90a6ddb788..7850576e4b7 100644--- a/studio/components/interfaces/SignIn/ForgotPasswordForm.tsx+++ b/studio/components/interfaces/SignIn/ForgotPasswordForm.tsx@@ -35,7 +35,7 @@ const ForgotPasswordForm = () => {hcaptchaToken: token ?? undefined,redirectTo: `${process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview'- ? process.env.NEXT_PUBLIC_VERCEL_URL+ ? process.env.NEXT_PUBLIC_VERCEL_URL + (router.basePath && `/${router.basePath}`): process.env.NEXT_PUBLIC_SITE_URL}/reset-password`,})diff --git a/studio/components/interfaces/SignIn/SignInSSOForm.tsx b/studio/components/interfaces/SignIn/SignInSSOForm.tsxindex 3c26d2dc1d6..138ee8b56b4 100644--- a/studio/components/interfaces/SignIn/SignInSSOForm.tsx+++ b/studio/components/interfaces/SignIn/SignInSSOForm.tsx@@ -2,6 +2,7 @@ import HCaptcha from '@hcaptcha/react-hcaptcha'import { useQueryClient } from '@tanstack/react-query'import { useStore } from 'hooks'import { auth, getReturnToPath } from 'lib/gotrue'+import { useRouter } from 'next/router'import { useRef, useState } from 'react'import { Button, Form, Input } from 'ui'import { object, string } from 'yup'@@ -12,6 +13,7 @@ const signInSchema = object({const SignInSSOForm = () => {const { ui } = useStore()+ const { basePath } = useRouter()const queryClient = useQueryClient()const [captchaToken, setCaptchaToken] = useState<string | null>(null)@@ -35,7 +37,7 @@ const SignInSSOForm = () => {captchaToken: token ?? undefined,redirectTo: `${process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview'- ? process.env.NEXT_PUBLIC_VERCEL_URL+ ? process.env.NEXT_PUBLIC_VERCEL_URL + (basePath && `/${basePath}`): process.env.NEXT_PUBLIC_SITE_URL}${getReturnToPath()}`,},diff --git a/studio/components/interfaces/SignIn/SignInWithGitHub.tsx b/studio/components/interfaces/SignIn/SignInWithGitHub.tsxindex f4e1f1549b6..d1f4eaa364f 100644--- a/studio/components/interfaces/SignIn/SignInWithGitHub.tsx+++ b/studio/components/interfaces/SignIn/SignInWithGitHub.tsx@@ -1,7 +1,9 @@import { auth, getReturnToPath } from 'lib/gotrue'+import { useRouter } from 'next/router'import { Button, IconGitHub } from 'ui'const SignInWithGitHub = () => {+ const { basePath } = useRouter()async function handleGithubSignIn() {try {const { error } = await auth.signInWithOAuth({@@ -9,7 +11,7 @@ const SignInWithGitHub = () => {options: {redirectTo: `${process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview'- ? process.env.NEXT_PUBLIC_VERCEL_URL+ ? process.env.NEXT_PUBLIC_VERCEL_URL + (basePath && `/${basePath}`): process.env.NEXT_PUBLIC_SITE_URL}${getReturnToPath()}`,},diff --git a/studio/components/interfaces/SignIn/SignUpForm.tsx b/studio/components/interfaces/SignIn/SignUpForm.tsxindex a506f8eda27..c9fd2a054b2 100644--- a/studio/components/interfaces/SignIn/SignUpForm.tsx+++ b/studio/components/interfaces/SignIn/SignUpForm.tsx@@ -8,6 +8,7 @@ import { post } from 'lib/common/fetch'import { API_URL } from 'lib/constants'import { passwordSchema } from 'lib/schemas'import PasswordConditionsHelper from './PasswordConditionsHelper'+import { useRouter } from 'next/router'const signUpSchema = passwordSchema.shape({email: yup.string().email().required().label('Email'),@@ -15,6 +16,7 @@ const signUpSchema = passwordSchema.shape({const SignUpForm = () => {const { ui } = useStore()+ const { basePath } = useRouter()const captchaRef = useRef<HCaptcha>(null)const [showConditions, setShowConditions] = useState(false)const [isSubmitted, setIsSubmitted] = useState(false)@@ -39,7 +41,7 @@ const SignUpForm = () => {hcaptchaToken: token ?? null,redirectTo: `${process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview'- ? process.env.NEXT_PUBLIC_VERCEL_URL+ ? process.env.NEXT_PUBLIC_VERCEL_URL + (basePath && `/${basePath}`): process.env.NEXT_PUBLIC_SITE_URL}/sign-in`,})