mirror of
https://github.com/docmost/docmost.git
synced 2026-07-27 08:14:41 +10:00
WIP
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
} from "@tanstack/react-query";
|
||||
import {
|
||||
createComment,
|
||||
createReadOnlyComment,
|
||||
CreateReadOnlyCommentData,
|
||||
deleteComment,
|
||||
getPageComments,
|
||||
updateComment,
|
||||
@@ -106,4 +108,23 @@ export function useDeleteCommentMutation(pageId?: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useCreateReadOnlyCommentMutation() {
|
||||
const queryClient = useQueryClient();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return useMutation<IComment, Error, CreateReadOnlyCommentData>({
|
||||
mutationFn: (data) => createReadOnlyComment(data),
|
||||
onSuccess: (data) => {
|
||||
queryClient.refetchQueries({ queryKey: RQ_KEY(data.pageId) });
|
||||
notifications.show({ message: t("Comment created successfully") });
|
||||
},
|
||||
onError: () => {
|
||||
notifications.show({
|
||||
message: t("Error creating comment"),
|
||||
color: "red",
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// EE: useResolveCommentMutation has been moved to @/ee/comment/queries/comment-query
|
||||
|
||||
Reference in New Issue
Block a user