Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Refactor types just a little bit more

dominik-zeglen0f59abcd6b1d
diff --git a/saleor/static/dashboard-next/index.tsx b/saleor/static/dashboard-next/index.tsx
index a8a2457d08..a3bc741f2a 100644
--- a/saleor/static/dashboard-next/index.tsx
+++ b/saleor/static/dashboard-next/index.tsx
@@ -98,6 +98,9 @@ export interface PartialMutationProviderRenderProps<
mutate: MutationFn<TData, TVariables>;
}
+export interface MutationProviderProps {
+ onError?: (error: ApolloError) => void;
+}
export type MutationProviderRenderProps<T> = (
props: T & { errors: UserError[] }
) => React.ReactElement<any>;
diff --git a/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx b/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx
index d64572b7fb..5ddf36bb59 100644
--- a/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx
@@ -2,6 +2,7 @@ import * as React from "react";
import { ApolloError } from "apollo-client";
import {
+ MutationProviderProps,
MutationProviderRenderProps,
PartialMutationProviderOutput,
PartialMutationProviderProps,
@@ -101,8 +102,7 @@ const ProductImageCreateProvider: React.StatelessComponent<
</TypedProductImageCreateMutation>
);
-interface ProductUpdateOperationsProps
- extends PartialMutationProviderProps<ProductImageCreateMutation> {
+interface ProductUpdateOperationsProps extends MutationProviderProps {
product?: ProductDetailsQuery["product"];
children: MutationProviderRenderProps<{
createProductImage: PartialMutationProviderOutput<
@@ -120,7 +120,6 @@ interface ProductUpdateOperationsProps
>;
}>;
onDelete?: (data: ProductDeleteMutation) => void;
- onError?: (error: ApolloError) => void;
onImageCreate?: (data: ProductImageCreateMutation) => void;
onImageReorder?: (data: ProductImageReorderMutation) => void;
onUpdate?: (data: ProductUpdateMutation) => void;