createComment(
{ postId, commenterId, content },
{
onSuccess: () => {
toast.success("Comment created :partying_face:", { richColors: true });
trpc.useUtils().post.getPostPageComments.invalidate();
},
onError: (error) => {
toast.error(error.message, { richColors: true });
// toast.error("Comment failed :cry:", { richColors: true });
},
onSettled: () => {
console.log("Settled");
if (!inputRef.current) return;
setContent("");
inputRef.current.value = "";
},
},
);
createComment(
{ postId, commenterId, content },
{
onSuccess: () => {
toast.success("Comment created :partying_face:", { richColors: true });
trpc.useUtils().post.getPostPageComments.invalidate();
},
onError: (error) => {
toast.error(error.message, { richColors: true });
// toast.error("Comment failed :cry:", { richColors: true });
},
onSettled: () => {
console.log("Settled");
if (!inputRef.current) return;
setContent("");
inputRef.current.value = "";
},
},
);