[Glitch] Convert polls to Typescript / Immutable Records

Port ded799f913 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Renaud Chaput authored and Claire committed 2024-12-25 21:21:39 +01:00
1 parent 967e095724
commit 37070a7881
15 files changed
+275 -186

No files matched your search

@@ -0,0 +1,10 @@
import { apiRequestGet, apiRequestPost } from 'flavours/glitch/api';
import type { ApiPollJSON } from 'flavours/glitch/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 },
});