mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 23:59:08 +03:00
patch type errors in warhouse collection mutations
This commit is contained in:
1 parent
e884e6afad
commit
d115bb8a8d
3 files changed
+19
-13
No files matched your search
@@ -3,18 +3,18 @@ import { analyticsKeys } from './keys'
|
||||
import { post } from 'data/fetchers'
|
||||
|
||||
async function createCollection(ref: string, payload: { name: string }) {
|
||||
await post(`/platform/projects/{ref}/analytics/warehouse/tenant`, {
|
||||
params: {
|
||||
path: { ref },
|
||||
},
|
||||
})
|
||||
// await post(`/platform/projects/{ref}/analytics/warehouse/tenant`, {
|
||||
// params: {
|
||||
// path: { ref },
|
||||
// },
|
||||
// })
|
||||
|
||||
const res = await post(`/platform/projects/{ref}/analytics/warehouse/collections`, {
|
||||
params: {
|
||||
path: { ref },
|
||||
},
|
||||
body: payload,
|
||||
})
|
||||
} as any) // TODO: Remove cast when openapi types get generated correctly
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -15,10 +15,11 @@ export function useDeleteCollection({
|
||||
const queryClient = useQueryClient()
|
||||
const mutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
await del(
|
||||
`/platform/projects/${projectRef}/analytics/warehouse/collections/${collectionToken}`,
|
||||
{}
|
||||
)
|
||||
await del(`/platform/projects/{ref}/analytics/warehouse/collections/{token}`, {
|
||||
params: {
|
||||
path: { ref: projectRef, token: collectionToken },
|
||||
} as any, // TODO: remove cast when openapi client generates correct types
|
||||
})
|
||||
|
||||
const keysToInvalidate = analyticsKeys.warehouseCollections(projectRef)
|
||||
queryClient.invalidateQueries(keysToInvalidate)
|
||||
|
||||
@@ -3,7 +3,7 @@ import { analyticsKeys } from './keys'
|
||||
import { patch } from 'data/fetchers'
|
||||
|
||||
type UpdateCollectionArgs = {
|
||||
projectRef: string,
|
||||
projectRef: string
|
||||
collectionToken: string
|
||||
}
|
||||
type UpdateCollectionPayload = {
|
||||
@@ -14,11 +14,16 @@ export function useUpdateCollection({ projectRef, collectionToken }: UpdateColle
|
||||
const queryClient = useQueryClient()
|
||||
const mutation = useMutation({
|
||||
mutationFn: async (payload: UpdateCollectionPayload) => {
|
||||
const resp = await patch(`/platform/projects/${projectRef}/analytics/warehouse/collections/${collectionToken}`, {body: payload})
|
||||
await patch(`/platform/projects/{ref}/analytics/warehouse/collections/{token}`, {
|
||||
params: {
|
||||
path: { ref: projectRef, token: collectionToken },
|
||||
},
|
||||
body: payload,
|
||||
} as any) // TODO: remove cast when openapi client generates correct types
|
||||
const keysToInvalidate = analyticsKeys.warehouseCollections(projectRef)
|
||||
queryClient.invalidateQueries(keysToInvalidate)
|
||||
},
|
||||
mutationKey: analyticsKeys.warehouseCollections(projectRef)
|
||||
mutationKey: analyticsKeys.warehouseCollections(projectRef),
|
||||
})
|
||||
|
||||
return mutation
|
||||
|
||||
Reference in new issue
Block a user