The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: Redirect the user after claiming a project (#39527)
Ivan Vasilov0eec4e224739
diff --git a/apps/studio/components/interfaces/Organization/ProjectClaim/confirm.tsx b/apps/studio/components/interfaces/Organization/ProjectClaim/confirm.tsxindex 65afd2049be..12ec20e15df 100644--- a/apps/studio/components/interfaces/Organization/ProjectClaim/confirm.tsx+++ b/apps/studio/components/interfaces/Organization/ProjectClaim/confirm.tsx@@ -47,16 +47,22 @@ export const ProjectClaimConfirm = ({const onClaimProject = async () => {try {- await approveRequest({ id: auth_id!, slug: selectedOrganization.slug })+ const response = await approveRequest({ id: auth_id!, slug: selectedOrganization.slug })await claimProject({slug: selectedOrganization.slug,token: claimToken!,})toast.success('Project claimed successfully')- // invalidate the org projects to force them to be refetched- queryClient.invalidateQueries(projectKeys.list())- router.push(`/org/${selectedOrganization.slug}`)+ try {+ // check if the redirect url is valid. If not, redirect the user to the org dashboard+ const url = new URL(response.url)+ window.location.href = url.toString()+ } catch {+ // invalidate the org projects to force them to be refetched+ queryClient.invalidateQueries(projectKeys.list())+ router.push(`/org/${selectedOrganization.slug}`)+ }} catch (error: any) {toast.error(`Failed to claim project ${error.message}`)}diff --git a/apps/studio/pages/claim-project.tsx b/apps/studio/pages/claim-project.tsxindex a109a561195..521f3959f23 100644--- a/apps/studio/pages/claim-project.tsx+++ b/apps/studio/pages/claim-project.tsx@@ -21,7 +21,7 @@ const ClaimProjectPageLayout = ({ children }: PropsWithChildren) => {return (<><Head>- <title>Claim project | {appTitle || 'Supabase'}</title>+ <title>{`Claim project | ${appTitle ?? 'Supabase'}`}</title></Head>{children}</>