quivr/frontend/lib/api/prompt/usePromptApi.ts
Mamadou DICKO b3fb8fc3bc
feat: add public prompts picker (#841)
* fix: update prompt_id logic in payload

* feat: add getPublicPrompts to sdk

* feat: add public prompt picker
2023-08-03 17:00:05 +02:00

25 lines
743 B
TypeScript

import { useAxios } from "@/lib/hooks";
import {
createPrompt,
CreatePromptProps,
getPrompt,
getPublicPrompts,
PromptUpdatableProperties,
updatePrompt,
} from "./prompt";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const usePromptApi = () => {
const { axiosInstance } = useAxios();
return {
createPrompt: async (prompt: CreatePromptProps) =>
createPrompt(prompt, axiosInstance),
getPrompt: async (promptId: string) => getPrompt(promptId, axiosInstance),
updatePrompt: async (promptId: string, prompt: PromptUpdatableProperties) =>
updatePrompt(promptId, prompt, axiosInstance),
getPublicPrompts: async () => await getPublicPrompts(axiosInstance),
};
};