saleor-dashboard/src/storybook/stories/orders/OrderShippingMethodEditDialog.tsx
Wojciech Mista 29461658a2
Add api error log in notifications (#1873)
* add api error log in notifications

* Refactor graphql error handling

* Update messages

* Install macaw-ui from commit hash

* Make notification id be ref index rather than date

* Refactor notification container styles to allow scroll

* Add fix to apollo onError function to get operation name

* Fix userPermission race-condition

* Add refactored error handling

* Temporarly install macaw from pill PR

* Handle case when there are no graphql errors

* Update errors

* Run build-types

* Update stories to include messages

* Update shipping types

* Traverse through onCompleted data and show errors

* Update tests

* Update messages

* Clear error notifications on submit

* Check if context exists - fix tests
2022-03-04 11:52:58 +01:00

45 lines
1.3 KiB
TypeScript

import { OrderErrorCode } from "@saleor/types/globalTypes";
import { storiesOf } from "@storybook/react";
import React from "react";
import OrderShippingMethodEditDialog, {
OrderShippingMethodEditDialogProps
} from "../../../orders/components/OrderShippingMethodEditDialog";
import { order as orderFixture } from "../../../orders/fixtures";
import Decorator from "../../Decorator";
const order = orderFixture("");
const props: OrderShippingMethodEditDialogProps = {
confirmButtonState: "default",
errors: [],
onClose: () => undefined,
onSubmit: () => undefined,
open: true,
shippingMethod: null,
shippingMethods: order.shippingMethods
};
storiesOf("Orders / OrderShippingMethodEditDialog", module)
.addDecorator(Decorator)
.add("default", () => <OrderShippingMethodEditDialog {...props} />)
.add("errors", () => (
<OrderShippingMethodEditDialog
{...props}
errors={[
{
__typename: "OrderError",
code: OrderErrorCode.SHIPPING_METHOD_NOT_APPLICABLE,
field: "shippingMethod",
addressType: null,
message: "Shipping method not applicable"
},
{
__typename: "OrderError",
code: OrderErrorCode.GRAPHQL_ERROR,
field: null,
addressType: null,
message: "Graphql error"
}
]}
/>
));