mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-15 01:46:47 +02:00
First public commit
This commit is contained in:
commit
e05cd62e53
228 changed files with 17717 additions and 0 deletions
23
api-client/add-participant.ts
Normal file
23
api-client/add-participant.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Participant, Vote } from "@prisma/client";
|
||||
import axios from "axios";
|
||||
|
||||
export interface AddParticipantPayload {
|
||||
pollId: string;
|
||||
name: string;
|
||||
votes: string[];
|
||||
}
|
||||
|
||||
export type AddParticipantResponse = Participant & {
|
||||
votes: Vote[];
|
||||
};
|
||||
|
||||
export const addParticipant = async (
|
||||
payload: AddParticipantPayload,
|
||||
): Promise<AddParticipantResponse> => {
|
||||
const res = await axios.post<AddParticipantResponse>(
|
||||
`/api/poll/${payload.pollId}/participant`,
|
||||
payload,
|
||||
);
|
||||
|
||||
return res.data;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue