chore: restrict users from creating workspace with reserved slugs (#692)

This commit is contained in:
Aaryan Khandelwal 2023-04-04 00:13:21 +05:30 committed by GitHub
parent 588247f1c1
commit 4af5921991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,15 @@ type Props = {
setDefaultValues: Dispatch<SetStateAction<any>>;
};
const restrictedUrls = [
"create-workspace",
"error",
"invitations",
"magic-sign-in",
"onboarding",
"signin",
];
export const CreateWorkspaceForm: React.FC<Props> = ({
onSubmit,
defaultValues,
@ -49,7 +58,7 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
await workspaceService
.workspaceSlugCheck(formData.slug)
.then(async (res) => {
if (res.status === true) {
if (res.status === true && !restrictedUrls.includes(formData.slug)) {
setSlugError(false);
await workspaceService
.createWorkspace(formData)