25 lines
544 B
TypeScript
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,
|
|
});
|
|
};
|