mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-14 01:16:48 +02:00
First public commit
This commit is contained in:
commit
e05cd62e53
228 changed files with 17717 additions and 0 deletions
25
api-client/update-poll.ts
Normal file
25
api-client/update-poll.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { Poll } from "@prisma/client";
|
||||
import axios from "axios";
|
||||
|
||||
export interface UpdatePollPayload {
|
||||
title?: string;
|
||||
timeZone?: string;
|
||||
location?: string;
|
||||
description?: string;
|
||||
optionsToDelete?: string[];
|
||||
optionsToAdd?: string[];
|
||||
notifications?: boolean;
|
||||
closed?: boolean;
|
||||
}
|
||||
|
||||
export const updatePoll = async (
|
||||
urlId: string,
|
||||
payload: UpdatePollPayload,
|
||||
): Promise<Poll> => {
|
||||
try {
|
||||
const { data } = await axios.patch<Poll>(`/api/poll/${urlId}`, payload);
|
||||
return data;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue