reactions
This commit is contained in:
parent
48e7094c5e
commit
c21e193fbf
9 changed files with 97 additions and 119 deletions
|
@ -60,31 +60,23 @@ export class PostsService {
|
|||
}
|
||||
|
||||
async addReaction(postId: string, emoji: string): Promise<void> {
|
||||
const response = await this.client.POST('/posts/{postId}/reactions', {
|
||||
await this.client.POST('/posts/{postId}/reactions', {
|
||||
params: {
|
||||
path: { postId }
|
||||
path: { postId },
|
||||
},
|
||||
body: { emoji },
|
||||
credentials: 'include',
|
||||
})
|
||||
|
||||
if (!response.data) {
|
||||
throw new Error('Failed to add reaction')
|
||||
}
|
||||
}
|
||||
|
||||
async removeReaction(postId: string, emoji: string): Promise<void> {
|
||||
const response = await this.client.DELETE('/posts/{postId}/reactions', {
|
||||
await this.client.DELETE('/posts/{postId}/reactions', {
|
||||
params: {
|
||||
path: { postId }
|
||||
path: { postId },
|
||||
},
|
||||
body: { emoji },
|
||||
credentials: 'include',
|
||||
})
|
||||
|
||||
if (!response.data) {
|
||||
throw new Error('Failed to remove reaction')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue