Skip to content

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

Navigate to order list after draft deleting

dominik-zeglen4d232f1629a2
diff --git a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
index 52309b5308..7133ba6103 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
@@ -167,7 +167,11 @@ const OrderOperations: React.StatelessComponent<OrderOperationsProps> = ({
onPaymentCapture,
onPaymentRefund,
onShippingMethodUpdate,
- onUpdate
+ onUpdate,
+ onDraftCancel,
+ onDraftFinalize,
+ onOrderFulfillmentCancel,
+ onOrderFulfillmentUpdate
}) => (
<OrderReleaseMutationProvider onError={onError} onSuccess={onOrderRelease}>
{orderRelease => (
@@ -227,15 +231,33 @@ const OrderOperations: React.StatelessComponent<OrderOperationsProps> = ({
>
{updateOrderLine => (
<OrderFulfillmentCancelProvider
+ onError={onError}
+ onSuccess={
+ onOrderFulfillmentCancel
+ }
>
{cancelFulfillment => (
<OrderFulfillmentUpdateTrackingProvider
+ onError={onError}
+ onSuccess={
+ onOrderFulfillmentUpdate
+ }
>
{updateTrackingNumber => (
<OrderDraftFinalizeMutationProvider
+ onError={onError}
+ onSuccess={
+ onDraftFinalize
+ }
>
{finalizeDraft => (
<OrderDraftCancelMutationProvider
+ onError={
+ onError
+ }
+ onSuccess={
+ onDraftCancel
+ }
>
{cancelDraft =>
children({
diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
index f5883e341e..bc8065aa6a 100644
--- a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
@@ -120,6 +120,14 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
})
});
};
+ const handleOrderDraftCancel = () => {
+ pushMessage({
+ text: i18n.t("Order successfully cancelled", {
+ context: "notification"
+ })
+ });
+ navigate(orderListUrl);
+ };
const handleOrderRelease = () => {
pushMessage({
text: i18n.t(
@@ -334,7 +342,7 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
onOrderFulfillmentCancel={handleFulfillmentCancel}
onOrderFulfillmentUpdate={handleFulfillmentUpdate}
onDraftFinalize={handleDraftFinalize}
- onDraftCancel={handleOrderCancel}
+ onDraftCancel={handleOrderDraftCancel}
>
{({
errors,