diondiondion e0d4e24071 [Glitch] refactor: Prevent leading slashes in API urls
Port c45ce549afe17cca1ba474a67112038e5966f68e to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2025-05-14 14:05:22 +02:00

11 lines
382 B
TypeScript

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`, {
choices,
});