Convert polls to Typescript / Immutable Records (#29789)
This commit is contained in:
parent
e4e35ab134
commit
ded799f913
15 changed files with 272 additions and 186 deletions
10
app/javascript/mastodon/api/polls.ts
Normal file
10
app/javascript/mastodon/api/polls.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { apiRequestGet, apiRequestPost } from 'mastodon/api';
|
||||
import type { ApiPollJSON } from 'mastodon/api_types/polls';
|
||||
|
||||
export const apiGetPoll = (pollId: string) =>
|
||||
apiRequestGet<ApiPollJSON>(`/v1/polls/${pollId}`);
|
||||
|
||||
export const apiPollVote = (pollId: string, choices: string[]) =>
|
||||
apiRequestPost<ApiPollJSON>(`/v1/polls/${pollId}/votes`, {
|
||||
data: { choices },
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue