Skip to content

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

Fix not working cancel button

dominik-zeglen6b4e5665b10c
diff --git a/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx b/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx
index 35f6b01da9..5dc15cd800 100644
--- a/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx
+++ b/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx
@@ -20,7 +20,7 @@ interface SaveButtonBarProps {
delete?: string;
save?: string;
};
- onCancel?: () => void;
+ onCancel: () => void;
onDelete?: () => void;
onSave(event: any);
}
diff --git a/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx
index 3462eb5e69..09554ec64f 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx
@@ -98,6 +98,7 @@ const CustomerEditPage: React.StatelessComponent<CustomerEditPageProps> = ({
<SaveButtonBar
disabled={disabled || !onSubmit || !hasChanged}
state={saveButtonBarState}
+ onCancel={onBack}
onSave={onSubmit}
/>
</Container>
diff --git a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
index 805297f868..67d09910d2 100644
--- a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
@@ -116,6 +116,7 @@ const ProductImagePage = decorate<ProductImagePageProps>(
<SaveButtonBar
disabled={disabled || !onSubmit || !hasChanged}
state={saveButtonBarState}
+ onCancel={onBack}
onDelete={onDelete}
onSave={submit}
/>
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index 306d016182..ea72c78f37 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -331,6 +331,7 @@ export const ProductUpdate = decorate<ProductUpdateProps>(
</div>
</div>
<SaveButtonBar
+ onCancel={onBack}
onDelete={toggleDeleteDialog}
onSave={submit}
state={saveButtonBarState}
diff --git a/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx b/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx
index fceed1e57f..3f24f55a0c 100644
--- a/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx
@@ -50,6 +50,7 @@ class InteractiveDemo extends React.Component<
render() {
return (
<SaveButtonBar
+ onCancel={() => undefined}
onSave={this.handleButtonClick}
state={this.state.state as any}
/>