3535 {{ $t("Confirmed") }}
3636 </span >
3737 <span v-if =" item.status === 'REJECTED'" >
38- {{ $("Rejected") }}
38+ {{ $t ("Rejected") }}
3939 </span >
4040 </template >
4141 </VColumn >
4545 <button class =" btn btn-danger btn-sm" @click =" handleRejectComment(item)" >
4646 <i class =" bi-ban" />
4747 </button >
48- <button class =" btn btn-success btn-sm z-3" data-bs-toggle =" tooltip" data-bs-placement =" top"
48+ <button class =" btn btn-success btn-sm z-3" data-bs-toggle =" tooltip" data-bs-placement =" top" @click = " handleConfirmComment(item.id) "
4949 data-bs-title =" Tooltip on top" >
5050 <i class =" bi-check-circle" />
5151 </button >
@@ -91,13 +91,17 @@ import VModal from "@/components/VModal.vue";
9191import { useFetchComments } from " @/composables/comments.composable" ;
9292import { useApplyFilters } from " @/composables/filter.composable" ;
9393import useFetchPost from " @/composables/posts.composable" ;
94+ import { useToast } from " @/composables/toast.composable" ;
95+ import ThemeColor from " @/enums/ThemeColor" ;
9496import StorageService from " @/services/storage.service" ;
9597import { computed , reactive , ref , watch } from " vue" ;
9698
9799export default {
98100 name: " CommentsView" ,
99101 setup () {
100- const { comments , commentsIsLoading , fetchComments } = useFetchComments ();
102+ const { showToast } = useToast ()
103+
104+ const { comments , commentsIsLoading , fetchComments , changeStatus: changeCommentStatus } = useFetchComments ();
101105 fetchComments ({});
102106
103107 const { post , postIsLoading , fetchPost } = useFetchPost ();
@@ -112,11 +116,14 @@ export default {
112116 rejectComment .comment = rejectedComment;
113117 rejectComment .modalIsOpen = true ;
114118 };
119+ const handleConfirmComment = (id )=> {
120+ changeCommentStatus (id,' CONFIRMED' )
121+ }
115122
116123 const handleFetchPost = async (id ) => {
117124 try {
118125 postModalIsOpen .value = true ;
119- await fetchPost (id);
126+ fetchPost (id). then ( res => console . log ( " res " , res)). catch ( err => console . log ( " err " , err) );
120127 } catch {
121128 postModalIsOpen .value = false ;
122129 }
@@ -169,7 +176,8 @@ export default {
169176 };
170177
171178 const handleConfirmRejection = () => {
172- // doing rejection here
179+ changeCommentStatus (rejectComment .comment .id , " REJECTED" )
180+ showToast ({ body: " undo" , theme: ThemeColor .WARNING , title: " Deleting" , duration: 3000 })
173181 rejectComment .comment = null
174182 rejectComment .modalIsOpen = false
175183 }
@@ -186,6 +194,7 @@ export default {
186194 handleRejectComment,
187195 handleConfirmRejection,
188196 rejectComment,
197+ handleConfirmComment
189198 };
190199 },
191200 components: {
0 commit comments