From 315309700292209261627e16069260e30ff72a7a Mon Sep 17 00:00:00 2001 From: Apostolof Date: Thu, 19 Nov 2020 23:07:47 +0200 Subject: [PATCH 1/2] Fix restore storing post state to default after done --- packages/concordia-app/src/components/PostCreate/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/concordia-app/src/components/PostCreate/index.jsx b/packages/concordia-app/src/components/PostCreate/index.jsx index 0047247..07e5752 100644 --- a/packages/concordia-app/src/components/PostCreate/index.jsx +++ b/packages/concordia-app/src/components/PostCreate/index.jsx @@ -101,6 +101,7 @@ const PostCreate = (props) => { setPostSubject(initialPostSubject); setPostContent(''); setPosting(false); + setStoringPost(false); setPostSubjectInputEmptySubmit(false); setPostContentInputEmptySubmit(false); setCreatePostCacheSendStackId(''); From 91279554b48844f3e3570a10549f3660c24397c6 Mon Sep 17 00:00:00 2001 From: Apostolof Date: Thu, 19 Nov 2020 23:26:24 +0200 Subject: [PATCH 2/2] Disable submits if values missing --- .../src/components/PostCreate/index.jsx | 15 +-------------- .../src/views/Topic/TopicCreate/index.jsx | 16 ++-------------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/packages/concordia-app/src/components/PostCreate/index.jsx b/packages/concordia-app/src/components/PostCreate/index.jsx index 07e5752..67c06b7 100644 --- a/packages/concordia-app/src/components/PostCreate/index.jsx +++ b/packages/concordia-app/src/components/PostCreate/index.jsx @@ -28,8 +28,6 @@ const PostCreate = (props) => { const [postSubject, setPostSubject] = useState(initialPostSubject); const [postContent, setPostContent] = useState(''); const [userProfilePictureUrl, setUserProfilePictureUrl] = useState(); - const [postSubjectInputEmptySubmit, setPostSubjectInputEmptySubmit] = useState(false); - const [postContentInputEmptySubmit, setPostContentInputEmptySubmit] = useState(false); const [createPostCacheSendStackId, setCreatePostCacheSendStackId] = useState(''); const [posting, setPosting] = useState(false); const [storingPost, setStoringPost] = useState(false); @@ -102,8 +100,6 @@ const PostCreate = (props) => { setPostContent(''); setPosting(false); setStoringPost(false); - setPostSubjectInputEmptySubmit(false); - setPostContentInputEmptySubmit(false); setCreatePostCacheSendStackId(''); }) .catch((reason) => { @@ -119,13 +115,7 @@ const PostCreate = (props) => { ]); const savePost = useCallback(() => { - if (postSubject === '') { - setPostSubjectInputEmptySubmit(true); - return; - } - - if (postContent === '') { - setPostContentInputEmptySubmit(true); + if (postSubject === '' || postContent === '') { return; } @@ -161,7 +151,6 @@ const PostCreate = (props) => { name="postSubject" className="subject-input" size="mini" - error={postSubjectInputEmptySubmit} value={postSubject} onChange={handleInputChange} /> @@ -175,10 +164,8 @@ const PostCreate = (props) => {