feat(ui,dashboard): Migrate SC tables to DataTable (#11106)

This commit is contained in:
Kasper Fabricius Kristensen
2025-02-07 15:26:49 +01:00
committed by GitHub
parent d588073cea
commit fcd3e2226e
34 changed files with 847 additions and 858 deletions

View File

@@ -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<