Skip to content

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

Drop custom error push messages

Marcin Gębala4cec5c3ee8da
diff --git a/saleor/static/dashboard-next/products/views/ProductCreate.tsx b/saleor/static/dashboard-next/products/views/ProductCreate.tsx
index 9b0864822d..75741225bd 100644
--- a/saleor/static/dashboard-next/products/views/ProductCreate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductCreate.tsx
@@ -28,8 +28,6 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
return (
<TypedProductCreateQuery query={productCreateQuery}>
{({ data, error, loading }) => {
- const handleError = () =>
- pushMessage({ text: i18n.t("Something went wrong") });
const handleSuccess = (data: ProductCreateMutation) => {
if (data.productCreate.errors.length === 0) {
pushMessage({ text: i18n.t("Product created") });
@@ -48,7 +46,6 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
return (
<TypedProductCreateMutation
onCompleted={handleSuccess}
- onError={handleError}
>
{(
productCreate,
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
index 6701fe3061..fd79c84d3f 100644
--- a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
@@ -1,7 +1,6 @@
import * as React from "react";
import { arrayMove } from "react-sortable-hoc";
-import { ApolloError } from "apollo-client";
import * as placeholderImg from "../../../images/placeholder255x255.png";
import { attributesListUrl } from "../../attributes";
import { categoryShowUrl } from "../../categories";
@@ -46,10 +45,6 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
pushMessage({ text: i18n.t("Product removed") });
navigate(categoryShowUrl(data.product.category.id));
};
- const handleError = (error: ApolloError) => {
- console.error(error.message);
- pushMessage({ text: i18n.t("Something went wrong") });
- };
const handleUpdate = () =>
pushMessage({ text: i18n.t("Saved changes") });
const handleImageCreate = () =>
@@ -80,7 +75,6 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
<ProductUpdateOperations
product={product}
onDelete={handleDelete}
- onError={handleError}
onImageCreate={handleImageCreate}
onImageDelete={handleImageDeleteSuccess}
onUpdate={handleUpdate}
diff --git a/saleor/static/dashboard-next/products/views/ProductVariant.tsx b/saleor/static/dashboard-next/products/views/ProductVariant.tsx
index bea3c823a5..f27ee54b8f 100644
--- a/saleor/static/dashboard-next/products/views/ProductVariant.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductVariant.tsx
@@ -1,6 +1,5 @@
import * as React from "react";
-import { ApolloError } from "apollo-client";
import { productUrl, productVariantEditUrl } from "..";
import * as placeholderImg from "../../../images/placeholder255x255.png";
import ErrorMessageCard from "../../components/ErrorMessageCard";
@@ -51,10 +50,6 @@ export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({
pushMessage({ text: i18n.t("Variant removed") });
navigate(productUrl(productId));
};
- const handleError = (error: ApolloError) => {
- console.error(error.message);
- pushMessage({ text: i18n.t("Something went wrong") });
- };
const handleUpdate = () =>
pushMessage({ text: i18n.t("Changes saved") });
@@ -63,7 +58,6 @@ export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({
productId={productId}
id={variantId}
onDelete={handleDelete}
- onError={handleError}
onUpdate={handleUpdate}
>
{({