The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix the query and mutation comments.
Ivan Vasilov7670bdf9def1
diff --git a/studio/data/auth/auth-config-query.ts b/studio/data/auth/auth-config-query.tsindex f1b8dc60235..7a933c9ab40 100644--- a/studio/data/auth/auth-config-query.ts+++ b/studio/data/auth/auth-config-query.ts@@ -1,8 +1,8 @@import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query'import { components } from 'data/api'-import { get, isResponseOk } from 'lib/common/fetch'-import { API_URL } from 'lib/constants'+import { get } from 'data/fetchers'import { useCallback } from 'react'+import { ResponseError } from 'types'import { authKeys } from './keys'export type AuthConfigVariables = {@@ -19,18 +19,20 @@ export async function getProjectAuthConfig(throw new Error('projectRef is required')}- const response = await get<AuthConfigResponse>(`${API_URL}/auth/${projectRef}/config`, {+ const { data, error } = await get('/platform/auth/{ref}/config', {+ params: {+ path: { ref: projectRef },+ },signal,})- if (!isResponseOk(response)) {- throw response.error- }- return response+ if (error) throw error++ return data}export type ProjectAuthConfigData = Awaited<ReturnType<typeof getProjectAuthConfig>>-export type ProjectAuthConfigError = unknown+export type ProjectAuthConfigError = ResponseErrorexport const useAuthConfigQuery = <TData = ProjectAuthConfigData>({ projectRef }: AuthConfigVariables,diff --git a/studio/data/auth/auth-config-update-mutation.ts b/studio/data/auth/auth-config-update-mutation.tsindex 908d9d1365f..f05ff956cb5 100644--- a/studio/data/auth/auth-config-update-mutation.ts+++ b/studio/data/auth/auth-config-update-mutation.ts@@ -2,8 +2,7 @@ import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/reactimport toast from 'react-hot-toast'import { components } from 'data/api'-import { patch } from 'lib/common/fetch'-import { API_URL } from 'lib/constants'+import { patch } from 'data/fetchers'import { ResponseError } from 'types'import { authKeys } from './keys'@@ -15,12 +14,22 @@ export type AuthConfigUpdateVariables = {export type UpdateAuthConfigResponse = components['schemas']['GoTrueConfig']export async function updateAuthConfig({ projectRef, config }: AuthConfigUpdateVariables) {- const response = await patch(`${API_URL}/auth/${projectRef}/config`, { ...config })- if (response.error) {- throw response.error- }+ const { data, error } = await patch('/platform/auth/{ref}/config', {+ params: {+ path: { ref: projectRef },+ },+ body: {+ // TODO: The config sent to the API can be partial according to the backend implementation.+ // The definition for the body https://github.com/supabase/infrastructure/blob/develop/api/src/routes/platform/auth/ref/config.dto.ts#L16 is wrong.+ // Every property type should be optional (with ?). When that's fixed, the new generated code will have the correct type.+ // Can be removed once https://github.com/supabase/infrastructure/pull/14167 goes in.+ ...(config as any),+ },+ })- return response as UpdateAuthConfigResponse+ if (error) throw error++ return data}type AuthConfigUpdateData = Awaited<ReturnType<typeof updateAuthConfig>>@@ -47,7 +56,7 @@ export const useAuthConfigUpdateMutation = ({},async onError(data, variables, context) {if (onError === undefined) {- toast.error(`Failed to mutate: ${data.message}`)+ toast.error(`Failed to update auth configuration: ${data.message}`)} else {onError(data, variables, context)}