This commit is contained in:
Magdalena Markusik 2020-09-25 18:02:28 +02:00
parent 8f43226e95
commit 70815b0d51
3 changed files with 11 additions and 1 deletions

View file

@ -178,6 +178,7 @@ export const CategoryUpdatePage: React.FC<CategoryUpdatePageProps> = ({
defaultMessage:
"Add search engine title and description to make this category easier to find"
})}
errors={errors}
title={data.seoTitle}
titlePlaceholder={data.name}
description={data.seoDescription}

View file

@ -151,6 +151,7 @@ const CollectionDetailsPage: React.FC<CollectionDetailsPageProps> = ({
defaultMessage:
"Add search engine title and description to make this collection easier to find"
})}
errors={errors}
slug={data.slug}
slugPlaceholder={data.name}
title={data.seoTitle}

View file

@ -1,10 +1,16 @@
import { PageErrorFragment } from "@saleor/fragments/types/PageErrorFragment";
import { commonMessages } from "@saleor/intl";
import { PageErrorCode } from "@saleor/types/globalTypes";
import { IntlShape } from "react-intl";
import { defineMessages, IntlShape } from "react-intl";
import commonErrorMessages from "./common";
const messages = defineMessages({
nameAlreadyTaken: {
defaultMessage: "This name is already taken. Please provide another."
}
});
function getPageErrorMessage(
err: Omit<PageErrorFragment, "__typename"> | undefined,
intl: IntlShape
@ -17,6 +23,8 @@ function getPageErrorMessage(
return intl.formatMessage(commonMessages.requiredField);
case PageErrorCode.INVALID:
return intl.formatMessage(commonErrorMessages.invalid);
case PageErrorCode.UNIQUE:
return intl.formatMessage(messages.nameAlreadyTaken);
default:
return intl.formatMessage(commonErrorMessages.unknownError);
}