fix: handle error message for special characters in Identifier of Project (#9059)

This commit is contained in:
Durgesh Shekhawat
2026-06-03 17:26:18 +05:30
committed by GitHub
parent b1c78fe4c8
commit 4280c4d1b1
2 changed files with 21 additions and 3 deletions
@@ -110,7 +110,7 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
if (setToFavorite) { if (setToFavorite) {
handleAddToFavorites(res.id); handleAddToFavorites(res.id);
} }
handleNextStep(res.id); return handleNextStep(res.id);
}) })
.catch((err) => { .catch((err) => {
try { try {
@@ -119,8 +119,9 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
const nameError = errorData.name?.includes("PROJECT_NAME_ALREADY_EXIST"); const nameError = errorData.name?.includes("PROJECT_NAME_ALREADY_EXIST");
const identifierError = errorData?.identifier?.includes("PROJECT_IDENTIFIER_ALREADY_EXIST"); const identifierError = errorData?.identifier?.includes("PROJECT_IDENTIFIER_ALREADY_EXIST");
const nameSpecialCharError = errorData?.name?.includes("PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS");
if (nameError || identifierError) { if (nameError || identifierError || nameSpecialCharError) {
if (nameError) { if (nameError) {
setToast({ setToast({
type: TOAST_TYPE.ERROR, type: TOAST_TYPE.ERROR,
@@ -136,6 +137,14 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
message: t("project_identifier_already_taken"), message: t("project_identifier_already_taken"),
}); });
} }
if (nameSpecialCharError) {
setToast({
type: TOAST_TYPE.ERROR,
title: t("toast.error"),
message: t("project_name_cannot_contain_special_characters"),
});
}
} else { } else {
setToast({ setToast({
type: TOAST_TYPE.ERROR, type: TOAST_TYPE.ERROR,
+10 -1
View File
@@ -105,8 +105,9 @@ export function ProjectDetailsForm(props: IProjectDetailsForm) {
const nameError = errorData.name?.includes("PROJECT_NAME_ALREADY_EXIST"); const nameError = errorData.name?.includes("PROJECT_NAME_ALREADY_EXIST");
const identifierError = errorData?.identifier?.includes("PROJECT_IDENTIFIER_ALREADY_EXIST"); const identifierError = errorData?.identifier?.includes("PROJECT_IDENTIFIER_ALREADY_EXIST");
const nameSpecialCharError = errorData?.name?.includes("PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS");
if (nameError || identifierError) { if (nameError || identifierError || nameSpecialCharError) {
if (nameError) { if (nameError) {
setToast({ setToast({
type: TOAST_TYPE.ERROR, type: TOAST_TYPE.ERROR,
@@ -122,6 +123,14 @@ export function ProjectDetailsForm(props: IProjectDetailsForm) {
message: t("project_identifier_already_taken"), message: t("project_identifier_already_taken"),
}); });
} }
if (nameSpecialCharError) {
setToast({
type: TOAST_TYPE.ERROR,
title: t("toast.error"),
message: t("project_name_cannot_contain_special_characters"),
});
}
} else { } else {
setToast({ setToast({
type: TOAST_TYPE.ERROR, type: TOAST_TYPE.ERROR,