Fix federated interactions and reply threads
This commit is contained in:
@@ -208,7 +208,12 @@ export default function ProfilePage() {
|
||||
|
||||
const handleLike = async (postId: string, currentLiked: boolean) => {
|
||||
const method = currentLiked ? 'DELETE' : 'POST';
|
||||
await fetch(`/api/posts/${postId}/like`, { method });
|
||||
const res = await fetch(`/api/posts/${postId}/like`, { method });
|
||||
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
throw new Error(data.error || 'Failed to update like');
|
||||
}
|
||||
};
|
||||
|
||||
const handleRepost = async (postId: string, currentReposted: boolean) => {
|
||||
|
||||
@@ -83,10 +83,13 @@ export default function PostDetailPage() {
|
||||
|
||||
const handleLike = async (postId: string, currentLiked: boolean) => {
|
||||
if (!did || !userHandle) return;
|
||||
if (currentLiked) {
|
||||
await signedAPI.unlikePost(postId, did, userHandle);
|
||||
} else {
|
||||
await signedAPI.likePost(postId, did, userHandle);
|
||||
const res = currentLiked
|
||||
? await signedAPI.unlikePost(postId, did, userHandle)
|
||||
: await signedAPI.likePost(postId, did, userHandle);
|
||||
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
throw new Error(data.error || 'Failed to update like');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user