update superadmin error

This commit is contained in:
sua yoo 2024-07-15 12:11:38 -07:00
parent 38a877fa8d
commit 8577b5bd93
No known key found for this signature in database
GPG Key ID: 5AD1B4C02D4F0567

View File

@ -391,10 +391,22 @@ export class Home extends LiteElement {
});
this.isAddingOrg = false;
} catch (e) {
let message = msg("Sorry, couldn't create organization at this time.");
if (isApiError(e)) {
if (e.details === "duplicate_org_name") {
message = msg("This org name is already taken, try another one.");
} else if (e.details === "duplicate_org_slug") {
message = msg("This org URL is already taken, try another one.");
} else if (e.details === "invalid_slug") {
message = msg(
"This org URL is invalid. Please use alphanumeric characters and dashes (-) only.",
);
}
}
this.notify({
message: isApiError(e)
? e.message
: msg("Sorry, couldn't create organization at this time."),
message,
variant: "danger",
icon: "exclamation-octagon",
});