Skip to content

Commit

Permalink
fix: restrictions: title, description - editPost
Browse files Browse the repository at this point in the history
  • Loading branch information
warmachine028 committed Nov 28, 2024
1 parent eff7d9f commit 3e23fd0
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions client/src/components/PostCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,11 @@ const EditCard = ({ post, setEditing }) => {
const handleChange = (event) => {
const { name, value, files } = event.target
setErrors({ ...errors, [name]: '' })

if (name === 'title' && value.length > 30) {
setErrors({
...errors,
title: 'Title must be less than 30 characters'
})
} else if (name === 'visibility') {
if (name === 'visibility') {
setEditedPost({
...editedPost,
visibility: value === 'PUBLIC' ? 'PRIVATE' : 'PUBLIC'
})
} else if (name === 'description' && value.length > 150) {
setErrors({
...errors,
description: 'Description must be less than 150 characters'
})
} else if (name === 'media' && files && files[0]) {
const file = files[0]
setEditedPost({ ...editedPost, [name]: file })
Expand Down

0 comments on commit 3e23fd0

Please sign in to comment.