The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
revert
Jonathan Summers-Muir4c4aaf562969
diff --git a/studio/components/interfaces/SignIn/ForgotPasswordForm.tsx b/studio/components/interfaces/SignIn/ForgotPasswordForm.tsxindex e90a6ddb788..f0a0b1ee79d 100644--- a/studio/components/interfaces/SignIn/ForgotPasswordForm.tsx+++ b/studio/components/interfaces/SignIn/ForgotPasswordForm.tsx@@ -14,6 +14,7 @@ const forgotPasswordSchema = object({const ForgotPasswordForm = () => {const { ui } = useStore()const router = useRouter()+ const { basePath } = routerconst [captchaToken, setCaptchaToken] = useState<string | null>(null)const captchaRef = useRef<HCaptcha>(null)@@ -35,7 +36,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 + (basePath && `/${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..e5211c6e2cb 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..7e1420574f1 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..50d2e806abe 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`,})diff --git a/studio/lib/gotrue.ts b/studio/lib/gotrue.tsindex 7cb3de31f7c..3e6d7f258f6 100644--- a/studio/lib/gotrue.ts+++ b/studio/lib/gotrue.ts@@ -1,5 +1,4 @@import { GoTrueClient, User } from '@supabase/gotrue-js'-import { useRouter } from 'next/router'export const STORAGE_KEY = process.env.NEXT_PUBLIC_STORAGE_KEY || 'supabase.dashboard.auth.token'@@ -42,7 +41,6 @@ export const getIdentity = (gotrueUser: User) => {// NOTE: do not use any imports in this function,// as it is used standalone in the documents headexport const getReturnToPath = (fallback = '/projects') => {- const { basePath } = useRouter()const searchParams = new URLSearchParams(location.search)let returnTo = searchParams.get('returnTo') ?? fallback@@ -50,5 +48,5 @@ export const getReturnToPath = (fallback = '/projects') => {const remainingSearchParams = searchParams.toString()- return basePath + returnTo + (remainingSearchParams ? `?${remainingSearchParams}` : '')+ return returnTo + (remainingSearchParams ? `?${remainingSearchParams}` : '')}