import { AxiosInstance } from "axios"; import { Prompt } from "@/lib/types/Prompt"; export type CreatePromptProps = { title: string; content: string; }; export const createPrompt = async ( prompt: CreatePromptProps, axiosInstance: AxiosInstance ): Promise => { return (await axiosInstance.post("/prompts", prompt)).data; }; export const getPrompt = async ( promptId: string, axiosInstance: AxiosInstance ): Promise => { return (await axiosInstance.get(`/prompts/${promptId}`)).data; }; export type PromptUpdatableProperties = { title: string; content: string; }; export const updatePrompt = async ( promptId: string, prompt: PromptUpdatableProperties, axiosInstance: AxiosInstance ): Promise => { return (await axiosInstance.put(`/prompts/${promptId}`, prompt)).data; }; export const getPublicPrompts = async ( axiosInstance: AxiosInstance ): Promise => { return (await axiosInstance.get("/prompts")).data; };