This commit is contained in:
john 2025-08-10 19:57:33 +02:00
parent 52b5a490ac
commit 91e1116532
9 changed files with 226 additions and 33 deletions

View file

@ -1,5 +1,6 @@
import { Post } from './posts.ts'
import { ApiClient } from '../../api/client.ts'
import { useUserStore } from '../../user/user.ts'
export class PostsService {
constructor(private readonly client: ApiClient) {}
@ -78,6 +79,17 @@ export class PostsService {
credentials: 'include',
})
}
async addComment(postId: string, content: string): Promise<void> {
const authorId = useUserStore.getState().user?.id
if (!authorId) return
await this.client.POST('/posts/{postId}/comments', {
params: { path: { postId } },
body: { content, authorId },
credentials: 'include',
})
}
}
interface CreatePostMedia {