2023-08-03 16:41:24 +03:00
|
|
|
import { useAxios } from "@/lib/hooks";
|
|
|
|
|
|
|
|
import {
|
|
|
|
createPrompt,
|
|
|
|
CreatePromptProps,
|
|
|
|
getPrompt,
|
2023-08-03 18:00:05 +03:00
|
|
|
getPublicPrompts,
|
2023-08-03 16:41:24 +03:00
|
|
|
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),
|
2023-08-03 18:00:05 +03:00
|
|
|
getPublicPrompts: async () => await getPublicPrompts(axiosInstance),
|
2023-08-03 16:41:24 +03:00
|
|
|
};
|
|
|
|
};
|