const followInfo = trpc.user.getFollowInfo.useQuery({ username });
const followMutation = trpc.user.followUser.useMutation({
onSettled: async () => {
await utils.user.getFollowInfo.invalidate({ username });
},
});
const unfollowMutation = trpc.user.unfollowUser.useMutation({
onSettled: async () => {
await utils.user.getFollowInfo.invalidate({ username });
},
});
const unfollow = () => {
unfollowMutation.mutate({ username });
};
const follow = () => {
followMutation.mutate({ username });
};
const followInfo = trpc.user.getFollowInfo.useQuery({ username });
const followMutation = trpc.user.followUser.useMutation({
onSettled: async () => {
await utils.user.getFollowInfo.invalidate({ username });
},
});
const unfollowMutation = trpc.user.unfollowUser.useMutation({
onSettled: async () => {
await utils.user.getFollowInfo.invalidate({ username });
},
});
const unfollow = () => {
unfollowMutation.mutate({ username });
};
const follow = () => {
followMutation.mutate({ username });
};