import { useTaehuiStore } from "@/state/Stores"; import { wwwAPI } from "@/utilities/wwwAPI"; import { useMutation } from "@tanstack/react-query"; import { getMillis } from "taehui-ts/date"; export default function usePostDrawing() { const { totem } = useTaehuiStore(); return useMutation({ mutationFn: async ({ file }: { file: File }) => { const form = new FormData(); form.append("data", file); await wwwAPI.post("/avatar/drawing", form, { headers: { millis: getMillis(), totem }, }); }, onSuccess: async () => { window.location.reload(); }, }); }