Skip to content

Commit

Permalink
fixed the problem with error showing on start
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronKeys committed Apr 21, 2024
1 parent 3d730cf commit bc96a8d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions FU.SPA/src/components/PostForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ const PostForm = ({ onSubmit, submitButtonText, initialValue }) => {

// Handles title state error
const handleTitleChange = (e) => {
if (e.target.value < 3) {
if (e.target.value.length < 3 && e.target.value.length > 0) {
setTitleError('Title must be longer than 3 characters');
setTitle(e.target.value);
} else {
setTitle(e.target.value);
setTitleError('');
}
setTitle(e.target.value);
};

// Handles start date state error
Expand Down Expand Up @@ -198,7 +198,7 @@ const PostForm = ({ onSubmit, submitButtonText, initialValue }) => {
<TextField
required
fullWidth
error={title?.length < 3}
error={titleError !== ''}
id="searchGames"
helperText={titleError}
minLength={3}
Expand Down

0 comments on commit bc96a8d

Please sign in to comment.