diff --git a/src/Components/Resource/CommentSection.tsx b/src/Components/Resource/CommentSection.tsx index 33ed68da45d..5b9929ed19f 100644 --- a/src/Components/Resource/CommentSection.tsx +++ b/src/Components/Resource/CommentSection.tsx @@ -4,7 +4,6 @@ import { formatDateTime } from "../../Utils/utils"; import CircularProgress from "../Common/components/CircularProgress"; import ButtonV2 from "../Common/components/ButtonV2"; import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; -import useQuery from "../../Utils/request/useQuery"; import routes from "../../Redux/api"; import PaginatedList from "../../CAREUI/misc/PaginatedList"; import { IComment } from "./models"; @@ -12,12 +11,6 @@ import request from "../../Utils/request/request"; const CommentSection = (props: { id: string }) => { const [commentBox, setCommentBox] = useState(""); - const { loading, refetch: resourceRefetch } = useQuery( - routes.getResourceComments, - { - pathParams: { id: props.id }, - } - ); const onSubmitComment = async () => { const payload = { @@ -35,49 +28,52 @@ const CommentSection = (props: { id: string }) => { }); if (res?.ok) { Notification.Success({ msg: "Comment added successfully" }); - resourceRefetch(); } setCommentBox(""); }; return ( -
- setCommentBox(e.value)} - /> -
- Post Your Comment -
-
- {loading ? ( - - ) : ( - - {() => ( -
- - No comments available - - - - - > - {(item) => } - -
- -
+ + {(_, query) => ( +
+ setCommentBox(e.value)} + /> + +
+ { + await onSubmitComment(); + query.refetch(); + }} + > + Post Your Comment + +
+
+
+ + No comments available + + + + + > + {(item) => } + +
+
- )} - - )} -
-
+
+
+
+ )} + ); };