// imports import { useMutation } from "@tanstack/vue-query"; import axios from "~/configs/axios.config"; import { API_ENDPOINTS } from "~/constants"; // types export type EditDocRequest = { id: number }; // methods export const handleEditDoc = async ({ id, name }: { id: string | undefined, name: string | undefined }) => { await axios.patch(`${API_ENDPOINTS.branch.getDoc}/${id}`, { name }); }; // composable const useEditDoc = (id: Ref) => { return useMutation({ mutationFn: ({ name }: { name: Ref }) => { return handleEditDoc({ id: id.value, name: name.value }); } }); }; export default useEditDoc;