diff --git a/frontend/src/features/AddWorkspace/index.tsx b/frontend/src/features/AddWorkspace/index.tsx index f333413..bc6d5e9 100644 --- a/frontend/src/features/AddWorkspace/index.tsx +++ b/frontend/src/features/AddWorkspace/index.tsx @@ -77,7 +77,7 @@ const AddWorkspace = () => { } }; - const validate: _VALIDATE_PROPS = (name, value, files) => { + const validate: _VALIDATE_PROPS = (name, value) => { switch (name) { case 'workspace': if (!value) { @@ -88,11 +88,6 @@ const AddWorkspace = () => { return 'Workspace name already exist'; } return ''; - case 'image': - if (!FileList) { - return 'File is required'; - } - return ''; case 'description': if (value.length > 200) { return 'Description should be less then 200 characters'; @@ -122,8 +117,8 @@ const AddWorkspace = () => { } }; const handleBlur = (e: React.FocusEvent) => { - const { name, value, files } = e.target; - const error = validate(name, value, files); + const { name, value } = e.target; + const error = validate(name, value); setFormErrors({ ...formErrors, [name]: error, @@ -132,17 +127,18 @@ const AddWorkspace = () => { const handleSubmit: _FORM_SUBMIT = (event) => { event.preventDefault(); - const workspace_error = validate('workspace', form.workspace, null); - const desc_error = validate('description', form.description, null); - const image_error = form.image ? '' : 'Image is required'; + const workspace_error = validate('workspace', form.workspace); + const desc_error = validate('description', form.description); setFormErrors({ ...formErrors, workspace: workspace_error, description: desc_error, - image: image_error, }); - if (workspace_error || desc_error || image_error) - toast.error('Check workspace, icon and description fields'); + if (workspace_error || desc_error) { + if (workspace_error) + toast.error('Check workspace field'); + if (desc_error) toast.error("Check description field") + } else { if (token) { const newForm = form; @@ -222,7 +218,7 @@ const AddWorkspace = () => { >

- Add Icon* + Add Icon

- {formErrors.image &&

{formErrors.image}

}