The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Merge branch 'master' into refactor/suparesponse-types
Greg Richardson189b1bb5eb1a
diff --cc studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsxindex 494f9f37e54,10d716a2e24..addc153125e--- a/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx+++ b/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx@@@ -95,8 -109,9 +109,9 @@@ const NewOrgForm = ({ onPaymentMethodRe})- if (response.error) {+ if (!isResponseOk(response)) {ui.setNotification({+ error: response.error,category: 'error',message: `Failed to create organization: ${response.error?.message ?? response.error}`,})diff --cc studio/components/interfaces/Organization/TeamSettings/TeamSettings.tsxindex 7948d6e0e6e,df83408bb36..e1a1ddf0d8a--- a/studio/components/interfaces/Organization/TeamSettings/TeamSettings.tsx+++ b/studio/components/interfaces/Organization/TeamSettings/TeamSettings.tsx@@@ -53,12 -54,12 +54,12 @@@ const TeamSettings = () =>try {confirmAlert({title: 'Are you sure?',- message: 'Are you sure you want to leave this team? This is permanent.',+ message: 'Are you sure you want to leave this organization? This is permanent.',onAsyncConfirm: async () => {- const response = await delete_(+ const response = await delete_<void>(`${API_URL}/organizations/${slug}/members/${profile!.gotrue_id}`)- if (response.error) {+ if (!isResponseOk(response)) {throw response.error} else {window?.location.replace('/') // Force reload to clear Storediff --cc studio/components/interfaces/Settings/General/General.tsxindex df12d34b855,a4f2ac6b4dd..853edb560aa--- a/studio/components/interfaces/Settings/General/General.tsx+++ b/studio/components/interfaces/Settings/General/General.tsx@@@ -14,13 -13,10 +13,11 @@@ import} from 'components/ui/Forms'import Panel from 'components/ui/Panel'import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'- import { invalidateProjectsQuery } from 'data/projects/projects-query'+ import { useProjectUpdateMutation } from 'data/projects/project-update-mutation'import { useCheckPermissions, useSelectedOrganization, useStore } from 'hooks'- import { isResponseOk, patch } from 'lib/common/fetch'- import { API_URL } from 'lib/constants'import PauseProjectButton from './Infrastructure/PauseProjectButton'import RestartServerButton from './Infrastructure/RestartServerButton'+import { Project } from 'types'const General = () => {const { ui } = useStore()diff --cc studio/components/interfaces/SignIn/ForgotPasswordForm.tsxindex de6fdad0f0e,9f3d1f75d8d..ff75d6bf90c--- a/studio/components/interfaces/SignIn/ForgotPasswordForm.tsx+++ b/studio/components/interfaces/SignIn/ForgotPasswordForm.tsx@@@ -55,7 -55,7 +55,7 @@@ const ForgotPasswordForm = () =>ui.setNotification({id: toastId,category: 'error',- message: response.error.message,- message: `Failed to send reset email: ${error.message}`,++ message: `Failed to send reset email: ${response.error.message}`,})}}diff --cc studio/components/interfaces/SignIn/SignUpForm.tsxindex cb4ca363034,8940445e12d..37c1afaaf57--- a/studio/components/interfaces/SignIn/SignUpForm.tsx+++ b/studio/components/interfaces/SignIn/SignUpForm.tsx@@@ -62,7 -62,7 +62,7 @@@ const SignUpForm = () =>ui.setNotification({id: toastId,category: 'error',- message: response.error.message,- message: `Failed to sign up: ${error.message}`,++ message: `Failed to sign up: ${response.error.message}`,})}}diff --cc studio/data/access-tokens/access-tokens-create-mutation.tsindex 309dc2c43d6,8b95776c300..6fb92b70ed4--- a/studio/data/access-tokens/access-tokens-create-mutation.ts+++ b/studio/data/access-tokens/access-tokens-create-mutation.ts@@@ -1,6 -1,9 +1,8 @@@import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+ import { toast } from 'react-hot-toast'--import { post } from 'lib/common/fetch'+import { isResponseOk, post } from 'lib/common/fetch'import { API_URL } from 'lib/constants'+ import { ResponseError } from 'types'import { AccessToken } from './access-tokens-query'import { accessTokenKeys } from './keys'diff --cc studio/data/access-tokens/access-tokens-delete-mutation.tsindex a1c014c49f9,23199143b77..f94f5734be6--- a/studio/data/access-tokens/access-tokens-delete-mutation.ts+++ b/studio/data/access-tokens/access-tokens-delete-mutation.ts@@@ -1,6 -1,9 +1,8 @@@import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+ import toast from 'react-hot-toast'--import { delete_ } from 'lib/common/fetch'+import { delete_, isResponseOk } from 'lib/common/fetch'import { API_URL } from 'lib/constants'+ import { ResponseError } from 'types'import { accessTokenKeys } from './keys'export type AccessTokenDeleteVariables = {diff --cc studio/data/content/content-create-mutation.tsindex 1428c78ee65,a08a1b6c9ea..cb9fb9a6de8--- a/studio/data/content/content-create-mutation.ts+++ b/studio/data/content/content-create-mutation.ts@@@ -1,7 -1,9 +1,8 @@@import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+ import toast from 'react-hot-toast'--import { post } from 'lib/common/fetch'+import { isResponseOk, post } from 'lib/common/fetch'import { API_URL } from 'lib/constants'- import { UserContent } from 'types'+ import { ResponseError, UserContent } from 'types'import { contentKeys } from './keys'type CreateContentVariables = {diff --cc studio/data/content/content-delete-mutation.tsindex 2072d0c4c27,3fce510a473..23cb612ab7c--- a/studio/data/content/content-delete-mutation.ts+++ b/studio/data/content/content-delete-mutation.ts@@@ -1,7 -1,9 +1,8 @@@import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+ import toast from 'react-hot-toast'--import { delete_ } from 'lib/common/fetch'+import { delete_, isResponseOk } from 'lib/common/fetch'import { API_URL } from 'lib/constants'- import { UserContent } from 'types'+ import { ResponseError, UserContent } from 'types'import { contentKeys } from './keys'type DeleteContentVariables = { projectRef: string; id: string }diff --cc studio/data/content/content-update-mutation.tsindex 7089fee27f5,5ce1afced6e..7d50bd8d68b--- a/studio/data/content/content-update-mutation.ts+++ b/studio/data/content/content-update-mutation.ts@@@ -1,7 -1,9 +1,8 @@@+ import toast from 'react-hot-toast'import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'--import { patch } from 'lib/common/fetch'+import { isResponseOk, patch } from 'lib/common/fetch'import { API_URL } from 'lib/constants'- import { UserContent } from 'types'+ import { ResponseError, UserContent } from 'types'import { contentKeys } from './keys'type UpdateContentVariables = {diff --cc studio/data/integrations/integrations-vercel-installed-connection-delete-mutation.tsindex 3601e55237a,f6ba1cd5e3f..9a8de1036ba--- a/studio/data/integrations/integrations-vercel-installed-connection-delete-mutation.ts+++ b/studio/data/integrations/integrations-vercel-installed-connection-delete-mutation.ts@@@ -1,8 -1,9 +1,9 @@@import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'-import { delete_ } from 'lib/common/fetch'+import { delete_, isResponseOk } from 'lib/common/fetch'import { API_URL } from 'lib/constants'- import { UserContent } from 'types'+ import { ResponseError, UserContent } from 'types'import { integrationKeys } from './keys'+ import { toast } from 'react-hot-toast'type DeleteVariables = {id: stringdiff --cc studio/data/subscriptions/org-subscription-update-mutation.tsindex 04c47ab8395,74db5bbba2f..0bd336be317--- a/studio/data/subscriptions/org-subscription-update-mutation.ts+++ b/studio/data/subscriptions/org-subscription-update-mutation.ts@@@ -1,8 -1,10 +1,9 @@@import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'-import { toast } from 'react-hot-toast'--import { put } from 'lib/common/fetch'+import { isResponseOk, put } from 'lib/common/fetch'import { API_URL } from 'lib/constants'-import { ResponseError, SupaResponseV2 } from 'types/base'++import { toast } from 'react-hot-toast'++import { ResponseError } from 'types/base'import { subscriptionKeys } from './keys'- import { SupaResponse } from 'types/base'export type SubscriptionTier =| 'tier_free'diff --cc studio/types/base.tsindex eb61191087d,0bb5a91c3eb..87def45a068--- a/studio/types/base.ts+++ b/studio/types/base.ts@@@ -83,10 -81,13 +81,10 @@@ export interface ResponseFailureerror: ResponseError}-// [Joshen] This should ideally be | but not changing now as its gonna cause a lot of build errors-export type SupaResponse<T> = T & ResponseFailure-// [Joshen] Use this for now, eventually deprecate SupaResponse<T> above-export type SupaResponseV2<T> = T | ResponseFailure+export type SupaResponse<T> = T | ResponseFailureexport interface ResponseError {- code: number+ code?: numbermessage: string- requestId: string+ requestId?: string}