[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:
parent
2014400bed
commit
0983e5f44d
21 changed files with 65 additions and 14 deletions
|
|
@ -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],
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue