feat: Add tax inclusivity management to currenices (#8112)
This commit is contained in:
@@ -31,7 +31,7 @@ export const usePricePreference = (
|
||||
) => {
|
||||
const { data, ...rest } = useQuery({
|
||||
queryFn: () => sdk.admin.pricePreference.retrieve(id, query),
|
||||
queryKey: pricePreferencesQueryKeys.detail(id),
|
||||
queryKey: pricePreferencesQueryKeys.detail(),
|
||||
...options,
|
||||
})
|
||||
|
||||
@@ -52,7 +52,7 @@ export const usePricePreferences = (
|
||||
) => {
|
||||
const { data, ...rest } = useQuery({
|
||||
queryFn: () => sdk.admin.pricePreference.list(query),
|
||||
queryKey: pricePreferencesQueryKeys.list(query),
|
||||
queryKey: pricePreferencesQueryKeys.list(),
|
||||
...options,
|
||||
})
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
import { sdk } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { pricePreferencesQueryKeys } from "./price-preferences"
|
||||
|
||||
const REGIONS_QUERY_KEY = "regions" as const
|
||||
export const regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY)
|
||||
@@ -67,6 +68,14 @@ export const useCreateRegion = (
|
||||
mutationFn: (payload) => sdk.admin.region.create(payload),
|
||||
onSuccess: (data, variables, context) => {
|
||||
queryClient.invalidateQueries({ queryKey: regionsQueryKeys.lists() })
|
||||
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pricePreferencesQueryKeys.list(),
|
||||
})
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pricePreferencesQueryKeys.details(),
|
||||
})
|
||||
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
},
|
||||
...options,
|
||||
@@ -87,6 +96,13 @@ export const useUpdateRegion = (
|
||||
queryClient.invalidateQueries({ queryKey: regionsQueryKeys.lists() })
|
||||
queryClient.invalidateQueries({ queryKey: regionsQueryKeys.detail(id) })
|
||||
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pricePreferencesQueryKeys.list(),
|
||||
})
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pricePreferencesQueryKeys.details(),
|
||||
})
|
||||
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
},
|
||||
...options,
|
||||
|
||||
@@ -11,6 +11,7 @@ import { HttpTypes } from "@medusajs/types"
|
||||
import { sdk } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { pricePreferencesQueryKeys } from "./price-preferences"
|
||||
|
||||
const STORE_QUERY_KEY = "store" as const
|
||||
export const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY)
|
||||
@@ -67,7 +68,14 @@ export const useUpdateStore = (
|
||||
return useMutation({
|
||||
mutationFn: (payload) => sdk.admin.store.update(id, payload),
|
||||
onSuccess: (data, variables, context) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pricePreferencesQueryKeys.list(),
|
||||
})
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: pricePreferencesQueryKeys.details(),
|
||||
})
|
||||
queryClient.invalidateQueries({ queryKey: storeQueryKeys.details() })
|
||||
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
},
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user