35
35
{{ $t("Confirmed") }}
36
36
</span >
37
37
<span v-if =" item.status === 'REJECTED'" >
38
- {{ $("Rejected") }}
38
+ {{ $t ("Rejected") }}
39
39
</span >
40
40
</template >
41
41
</VColumn >
45
45
<button class =" btn btn-danger btn-sm" @click =" handleRejectComment(item)" >
46
46
<i class =" bi-ban" />
47
47
</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) "
49
49
data-bs-title =" Tooltip on top" >
50
50
<i class =" bi-check-circle" />
51
51
</button >
@@ -91,13 +91,17 @@ import VModal from "@/components/VModal.vue";
91
91
import { useFetchComments } from " @/composables/comments.composable" ;
92
92
import { useApplyFilters } from " @/composables/filter.composable" ;
93
93
import useFetchPost from " @/composables/posts.composable" ;
94
+ import { useToast } from " @/composables/toast.composable" ;
95
+ import ThemeColor from " @/enums/ThemeColor" ;
94
96
import StorageService from " @/services/storage.service" ;
95
97
import { computed , reactive , ref , watch } from " vue" ;
96
98
97
99
export default {
98
100
name: " CommentsView" ,
99
101
setup () {
100
- const { comments , commentsIsLoading , fetchComments } = useFetchComments ();
102
+ const { showToast } = useToast ()
103
+
104
+ const { comments , commentsIsLoading , fetchComments , changeStatus: changeCommentStatus } = useFetchComments ();
101
105
fetchComments ({});
102
106
103
107
const { post , postIsLoading , fetchPost } = useFetchPost ();
@@ -112,11 +116,14 @@ export default {
112
116
rejectComment .comment = rejectedComment;
113
117
rejectComment .modalIsOpen = true ;
114
118
};
119
+ const handleConfirmComment = (id )=> {
120
+ changeCommentStatus (id,' CONFIRMED' )
121
+ }
115
122
116
123
const handleFetchPost = async (id ) => {
117
124
try {
118
125
postModalIsOpen .value = true ;
119
- await fetchPost (id);
126
+ fetchPost (id). then ( res => console . log ( " res " , res)). catch ( err => console . log ( " err " , err) );
120
127
} catch {
121
128
postModalIsOpen .value = false ;
122
129
}
@@ -169,7 +176,8 @@ export default {
169
176
};
170
177
171
178
const handleConfirmRejection = () => {
172
- // doing rejection here
179
+ changeCommentStatus (rejectComment .comment .id , " REJECTED" )
180
+ showToast ({ body: " undo" , theme: ThemeColor .WARNING , title: " Deleting" , duration: 3000 })
173
181
rejectComment .comment = null
174
182
rejectComment .modalIsOpen = false
175
183
}
@@ -186,6 +194,7 @@ export default {
186
194
handleRejectComment,
187
195
handleConfirmRejection,
188
196
rejectComment,
197
+ handleConfirmComment
189
198
};
190
199
},
191
200
components: {
0 commit comments