mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-29 10:16:32 +02:00
18 lines
393 B
TypeScript
18 lines
393 B
TypeScript
import { Comment } from "@prisma/client";
|
|
import axios from "axios";
|
|
|
|
export interface CreateCommentPayload {
|
|
pollId: string;
|
|
content: string;
|
|
authorName: string;
|
|
}
|
|
|
|
export const createComment = async (
|
|
payload: CreateCommentPayload,
|
|
): Promise<Comment> => {
|
|
const { data } = await axios.post<Comment>(
|
|
`/api/poll/${payload.pollId}/comments`,
|
|
payload,
|
|
);
|
|
return data;
|
|
};
|