feat(dashboard): Admin UI regions v2 (#6943)

This commit is contained in:
Frane Polić
2024-04-06 17:41:54 +02:00
committed by GitHub
parent df0751f122
commit 58c68f6715
72 changed files with 475 additions and 1687 deletions

View 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 }
}

View File

@@ -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,
})