From dad416e6e2c792a51de735ed087237bd2781f61e Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Sat, 27 Feb 2021 18:11:38 +0700 Subject: [PATCH] #34 made submitting comment form --- .../comment/LocalCommentForm/index.tsx | 12 +-- src/components/node/NodeCommentForm/index.tsx | 2 +- src/redux/node/actions.ts | 15 ++- src/redux/node/constants.ts | 1 + src/redux/node/sagas.ts | 97 +++++++++++++------ src/utils/hooks/useCommentFormFormik.ts | 35 +++---- 6 files changed, 97 insertions(+), 65 deletions(-) diff --git a/src/components/comment/LocalCommentForm/index.tsx b/src/components/comment/LocalCommentForm/index.tsx index 1511cb91..15ead652 100644 --- a/src/components/comment/LocalCommentForm/index.tsx +++ b/src/components/comment/LocalCommentForm/index.tsx @@ -15,20 +15,13 @@ import { EMPTY_COMMENT } from '~/redux/node/constants'; interface IProps { comment?: IComment; nodeId: INode['id']; - isBefore?: boolean; onCancelEdit?: () => void; } -const LocalCommentForm: FC = ({ comment, nodeId, isBefore, onCancelEdit }) => { +const LocalCommentForm: FC = ({ comment, nodeId, onCancelEdit }) => { const [textarea, setTextarea] = useState(); const uploader = useFileUploader(UPLOAD_SUBJECTS.COMMENT, UPLOAD_TARGETS.COMMENTS); - const formik = useCommentFormFormik( - comment || EMPTY_COMMENT, - nodeId, - uploader, - onCancelEdit, - isBefore - ); + const formik = useCommentFormFormik(comment || EMPTY_COMMENT, nodeId, uploader, onCancelEdit); const isLoading = formik.isSubmitting || uploader.isUploading; const isEditing = !!comment?.id; @@ -51,6 +44,7 @@ const LocalCommentForm: FC = ({ comment, nodeId, isBefore, onCancelEdit )}