feat(dashboard): Admin UI regions v2 (#6943)
This commit is contained in:
24
packages/admin-next/dashboard/src/hooks/api/payments.ts
Normal file
24
packages/admin-next/dashboard/src/hooks/api/payments.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { QueryKey, useQuery, UseQueryOptions } from "@tanstack/react-query"
|
||||
import { PaymentProvidersListRes } from "../../types/api-responses"
|
||||
import { client } from "../../lib/client"
|
||||
|
||||
export const usePaymentProviders = (
|
||||
query?: Record<string, any>,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
PaymentProvidersListRes,
|
||||
Error,
|
||||
PaymentProvidersListRes,
|
||||
QueryKey
|
||||
>,
|
||||
"queryKey" | "queryFn"
|
||||
>
|
||||
) => {
|
||||
const { data, ...rest } = useQuery({
|
||||
queryFn: async () => client.payments.listPaymentProviders(query),
|
||||
queryKey: [],
|
||||
...options,
|
||||
})
|
||||
|
||||
return { ...data, ...rest }
|
||||
}
|
||||
@@ -20,6 +20,7 @@ const regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY)
|
||||
|
||||
export const useRegion = (
|
||||
id: string,
|
||||
query?: Record<string, any>,
|
||||
options?: Omit<
|
||||
UseQueryOptions<RegionRes, Error, RegionRes, QueryKey>,
|
||||
"queryFn" | "queryKey"
|
||||
@@ -27,7 +28,7 @@ export const useRegion = (
|
||||
) => {
|
||||
const { data, ...rest } = useQuery({
|
||||
queryKey: regionsQueryKeys.detail(id),
|
||||
queryFn: async () => client.regions.retrieve(id),
|
||||
queryFn: async () => client.regions.retrieve(id, query),
|
||||
...options,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user