Files
dmenu-plus-front/src/app/[name]/(Profile)/profile/hooks/userProfileData.ts
T
2026-06-06 10:56:59 +03:30

25 lines
544 B
TypeScript

import { useMutation, useQuery } from "@tanstack/react-query";
import * as api from "../service/ProfileService";
import { hasAuthToken } from "@/lib/api/func";
export const useGetProfile = () => {
return useQuery({
queryKey: ["profile"],
queryFn: api.getProfile,
retry: false,
enabled: hasAuthToken(),
});
};
export const useUpdateProfile = () => {
return useMutation({
mutationFn: api.updateProfile,
});
};
export const useSingleUpload = () => {
return useMutation({
mutationFn: api.singleUpload,
});
};