[WEB-4281] chore: project error message updated (#7190)

* chore: project error message updated

* fix: error message for project creation

* fix: incorrect error code

* chore: code refactor

* chore: code refactor

---------

Co-authored-by: sangeethailango <sangeethailango21@gmail.com>
This commit is contained in:
Anmol Singh Bhatia 2025-06-16 17:19:44 +05:30 committed by GitHub
parent 2014400bed
commit 0983e5f44d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 65 additions and 14 deletions

View file

@ -49,7 +49,7 @@ export const CreateProjectForm: FC<TCreateProjectFormProps> = observer((props) =
addProjectToFavorites(workspaceSlug.toString(), projectId).catch(() => {
setToast({
type: TOAST_TYPE.ERROR,
title: t("error"),
title: t("toast.error"),
message: t("failed_to_remove_project_from_favorites"),
});
});
@ -89,20 +89,27 @@ export const CreateProjectForm: FC<TCreateProjectFormProps> = observer((props) =
handleNextStep(res.id);
})
.catch((err) => {
Object.keys(err?.data ?? {}).map((key) => {
if (err?.data.code === "PROJECT_NAME_ALREADY_EXIST") {
setToast({
type: TOAST_TYPE.ERROR,
title: t("error"),
message: err.data[key],
title: t("toast.error"),
message: t("project_name_already_taken"),
});
captureProjectEvent({
eventName: PROJECT_CREATED,
payload: {
...formData,
state: "FAILED",
},
} else if (err?.data.code === "PROJECT_IDENTIFIER_ALREADY_EXIST") {
setToast({
type: TOAST_TYPE.ERROR,
title: t("toast.error"),
message: t("project_identifier_already_taken"),
});
});
} else {
Object.keys(err?.data ?? {}).map((key) => {
setToast({
type: TOAST_TYPE.ERROR,
title: t("error"),
message: err.data[key],
});
});
}
});
};