fix: prevent creating multiple platform orgs (#16629)

* set error messages to know whats wrong

* trying to find if org with same owner already exists

* ensure a user cannot create more than one platform team

---------

Co-authored-by: Anik Dhabal Babu <[email protected]>
This commit is contained in:
Rajiv SahalandAnik Dhabal Babu authored and GitHub committed 2024-09-13 23:37:48 +01:00
1 parent e3e2bc804a
commit a775e42e85
2 files changed
+12

No files matched your search

@@ -65,11 +65,13 @@ const CreateANewPlatformFormChild = ({ session }: { session: Ensure<SessionConte
onError: (err) => {
if (err.message === "organization_url_taken") {
newOrganizationFormMethods.setError("slug", { type: "custom", message: t("url_taken") });
setServerErrorMessage(err.message);
} else if (err.message === "domain_taken_team" || err.message === "domain_taken_project") {
newOrganizationFormMethods.setError("slug", {
type: "custom",
message: t("problem_registering_domain"),
});
setServerErrorMessage(err.message);
} else {
setServerErrorMessage(err.message);
}