feat(ui,dashboard): Migrate SC tables to DataTable (#11106)
This commit is contained in:
committed by
GitHub
parent
d588073cea
commit
fcd3e2226e
@@ -41,7 +41,7 @@ export const useSalesChannel = (
|
||||
}
|
||||
|
||||
export const useSalesChannels = (
|
||||
query?: Record<string, any>,
|
||||
query?: HttpTypes.AdminSalesChannelListParams,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
AdminSalesChannelListResponse,
|
||||
@@ -133,6 +133,34 @@ export const useDeleteSalesChannel = (
|
||||
})
|
||||
}
|
||||
|
||||
export const useDeleteSalesChannelLazy = (
|
||||
options?: UseMutationOptions<
|
||||
HttpTypes.AdminSalesChannelDeleteResponse,
|
||||
FetchError,
|
||||
string
|
||||
>
|
||||
) => {
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => sdk.admin.salesChannel.delete(id),
|
||||
onSuccess: (data, variables, context) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: salesChannelsQueryKeys.lists(),
|
||||
})
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: salesChannelsQueryKeys.detail(variables),
|
||||
})
|
||||
|
||||
// Invalidate all products to ensure they are updated if they were linked to the sales channel
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: productsQueryKeys.all,
|
||||
})
|
||||
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
},
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
export const useSalesChannelRemoveProducts = (
|
||||
id: string,
|
||||
options?: UseMutationOptions<
|
||||
|
||||
Reference in New Issue
Block a user