Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Handle image upload errors
dominik-zeglenbcffdd8ce622
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsxindex 7a84997f6f..a885ac79a9 100644--- a/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx+++ b/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx@@ -26,6 +26,10 @@ import {productVariantEditUrl} from "../../urls";import { productRemovePath, productRemoveUrl } from "./urls";+import {+ ProductImageCreate,+ ProductImageCreateVariables+} from "../../types/ProductImageCreate";interface ProductUpdateProps {id: string;@@ -62,10 +66,20 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({};const handleUpdate = () =>pushMessage({ text: i18n.t("Saved changes") });- const handleImageCreate = () =>- pushMessage({- text: i18n.t("Image successfully uploaded")- });+ const handleImageCreate = (+ data: ProductImageCreate+ ) => {+ const imageError = data.productImageCreate.errors.find(+ error =>+ error.field ===+ ("image" as keyof ProductImageCreateVariables)+ );+ if (imageError) {+ pushMessage({+ text: imageError.message+ });+ }+ };const handleImageDeleteSuccess = () =>pushMessage({text: i18n.t("Image successfully deleted")