fixes
This commit is contained in:
parent
8f43226e95
commit
70815b0d51
3 changed files with 11 additions and 1 deletions
|
@ -178,6 +178,7 @@ export const CategoryUpdatePage: React.FC<CategoryUpdatePageProps> = ({
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"Add search engine title and description to make this category easier to find"
|
"Add search engine title and description to make this category easier to find"
|
||||||
})}
|
})}
|
||||||
|
errors={errors}
|
||||||
title={data.seoTitle}
|
title={data.seoTitle}
|
||||||
titlePlaceholder={data.name}
|
titlePlaceholder={data.name}
|
||||||
description={data.seoDescription}
|
description={data.seoDescription}
|
||||||
|
|
|
@ -151,6 +151,7 @@ const CollectionDetailsPage: React.FC<CollectionDetailsPageProps> = ({
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"Add search engine title and description to make this collection easier to find"
|
"Add search engine title and description to make this collection easier to find"
|
||||||
})}
|
})}
|
||||||
|
errors={errors}
|
||||||
slug={data.slug}
|
slug={data.slug}
|
||||||
slugPlaceholder={data.name}
|
slugPlaceholder={data.name}
|
||||||
title={data.seoTitle}
|
title={data.seoTitle}
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
import { PageErrorFragment } from "@saleor/fragments/types/PageErrorFragment";
|
import { PageErrorFragment } from "@saleor/fragments/types/PageErrorFragment";
|
||||||
import { commonMessages } from "@saleor/intl";
|
import { commonMessages } from "@saleor/intl";
|
||||||
import { PageErrorCode } from "@saleor/types/globalTypes";
|
import { PageErrorCode } from "@saleor/types/globalTypes";
|
||||||
import { IntlShape } from "react-intl";
|
import { defineMessages, IntlShape } from "react-intl";
|
||||||
|
|
||||||
import commonErrorMessages from "./common";
|
import commonErrorMessages from "./common";
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
nameAlreadyTaken: {
|
||||||
|
defaultMessage: "This name is already taken. Please provide another."
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function getPageErrorMessage(
|
function getPageErrorMessage(
|
||||||
err: Omit<PageErrorFragment, "__typename"> | undefined,
|
err: Omit<PageErrorFragment, "__typename"> | undefined,
|
||||||
intl: IntlShape
|
intl: IntlShape
|
||||||
|
@ -17,6 +23,8 @@ function getPageErrorMessage(
|
||||||
return intl.formatMessage(commonMessages.requiredField);
|
return intl.formatMessage(commonMessages.requiredField);
|
||||||
case PageErrorCode.INVALID:
|
case PageErrorCode.INVALID:
|
||||||
return intl.formatMessage(commonErrorMessages.invalid);
|
return intl.formatMessage(commonErrorMessages.invalid);
|
||||||
|
case PageErrorCode.UNIQUE:
|
||||||
|
return intl.formatMessage(messages.nameAlreadyTaken);
|
||||||
default:
|
default:
|
||||||
return intl.formatMessage(commonErrorMessages.unknownError);
|
return intl.formatMessage(commonErrorMessages.unknownError);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue