Skip to content

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

Add notifications after update

dominik-zeglenbed3327a51dd
diff --git a/saleor/static/dashboard-next/discounts/views/SaleDetails/index.tsx b/saleor/static/dashboard-next/discounts/views/SaleDetails/index.tsx
index 891c56b639..72839424e7 100644
--- a/saleor/static/dashboard-next/discounts/views/SaleDetails/index.tsx
+++ b/saleor/static/dashboard-next/discounts/views/SaleDetails/index.tsx
@@ -36,6 +36,7 @@ import {
import { TypedSaleDetails } from "../../queries";
import { SaleCataloguesAdd } from "../../types/SaleCataloguesAdd";
import { SaleDelete } from "../../types/SaleDelete";
+import { SaleUpdate } from "../../types/SaleUpdate";
import { saleListUrl, saleUrl } from "../../urls";
import {
saleAssignCategoriesPath,
@@ -108,12 +109,22 @@ export const SaleDetails: React.StatelessComponent<SaleDetailsProps> = ({
}
};
+ const handleSaleUpdate = (data: SaleUpdate) => {
+ if (data.saleUpdate.errors.length === 0) {
+ pushMessage({
+ text: i18n.t("Updated sale", {
+ context: "notification"
+ })
+ });
+ }
+ };
+
return (
<TypedSaleCataloguesRemove>
{(saleCataloguesRemove, saleCataloguesRemoveOpts) => (
<TypedSaleCataloguesAdd onCompleted={handleCatalogueAdd}>
{(saleCataloguesAdd, saleCataloguesAddOpts) => (
- <TypedSaleUpdate>
+ <TypedSaleUpdate onCompleted={handleSaleUpdate}>
{(saleUpdate, saleUpdateOpts) => (
<TypedSaleDelete onCompleted={handleSaleDelete}>
{(saleDelete, saleDeleteOpts) => (
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherDetails/index.tsx b/saleor/static/dashboard-next/discounts/views/VoucherDetails/index.tsx
index 8a32d36e39..e89d4e6288 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherDetails/index.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherDetails/index.tsx
@@ -121,6 +121,11 @@ export const VoucherDetails: React.StatelessComponent<VoucherDetailsProps> = ({
if (data.voucherUpdate.errors.length === 0) {
navigate(voucherUrl(id), true, true);
}
+ pushMessage({
+ text: i18n.t("Updated voucher", {
+ context: "notification"
+ })
+ });
};
return (