Fix type errors
This commit is contained in:
parent
f0b90318fd
commit
b2987cddac
3 changed files with 11 additions and 12 deletions
|
@ -12,7 +12,7 @@ import { FormSpacer } from "@saleor/components/FormSpacer";
|
||||||
import SingleSelectField from "@saleor/components/SingleSelectField";
|
import SingleSelectField from "@saleor/components/SingleSelectField";
|
||||||
import { buttonMessages } from "@saleor/intl";
|
import { buttonMessages } from "@saleor/intl";
|
||||||
import { DialogProps } from "@saleor/types";
|
import { DialogProps } from "@saleor/types";
|
||||||
import { getFieldError, getFormErrors } from "@saleor/utils/errors";
|
import { getFormErrors } from "@saleor/utils/errors";
|
||||||
import { ShopErrorFragment } from "@saleor/siteSettings/types/ShopErrorFragment";
|
import { ShopErrorFragment } from "@saleor/siteSettings/types/ShopErrorFragment";
|
||||||
import getShopErrorMessage from "@saleor/utils/errors/shop";
|
import getShopErrorMessage from "@saleor/utils/errors/shop";
|
||||||
import { authorizationKeyTypes } from "../../../misc";
|
import { authorizationKeyTypes } from "../../../misc";
|
||||||
|
|
|
@ -51,14 +51,7 @@ export const SiteSettings: React.FC<SiteSettingsProps> = ({ params }) => {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
notify({
|
notify({
|
||||||
text: intl.formatMessage(
|
text: intl.formatMessage(commonMessages.somethingWentWrong)
|
||||||
{
|
|
||||||
defaultMessage: "Could not delete authorization key: {errorMessage}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
errorMessage: data.authorizationKeyDelete.errors[0].message
|
|
||||||
}
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,9 +4,11 @@ import React from "react";
|
||||||
import SiteSettingsKeyDialog, {
|
import SiteSettingsKeyDialog, {
|
||||||
SiteSettingsKeyDialogProps
|
SiteSettingsKeyDialogProps
|
||||||
} from "../../../siteSettings/components/SiteSettingsKeyDialog";
|
} from "../../../siteSettings/components/SiteSettingsKeyDialog";
|
||||||
import { AuthorizationKeyType } from "../../../types/globalTypes";
|
import {
|
||||||
|
AuthorizationKeyType,
|
||||||
|
ShopErrorCode
|
||||||
|
} from "../../../types/globalTypes";
|
||||||
import Decorator from "../../Decorator";
|
import Decorator from "../../Decorator";
|
||||||
import { formError } from "../../misc";
|
|
||||||
|
|
||||||
const props: SiteSettingsKeyDialogProps = {
|
const props: SiteSettingsKeyDialogProps = {
|
||||||
errors: [],
|
errors: [],
|
||||||
|
@ -26,6 +28,10 @@ storiesOf("SiteSettings / Add key dialog", module)
|
||||||
.add("form errors", () => (
|
.add("form errors", () => (
|
||||||
<SiteSettingsKeyDialog
|
<SiteSettingsKeyDialog
|
||||||
{...props}
|
{...props}
|
||||||
errors={["key", "password", "keyType"].map(field => formError(field))}
|
errors={["key", "password", "keyType"].map(field => ({
|
||||||
|
__typename: "ShopError",
|
||||||
|
code: ShopErrorCode.INVALID,
|
||||||
|
field
|
||||||
|
}))}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in a new issue