new changes

This commit is contained in:
Mamalizz
2025-03-27 23:07:45 +03:30
parent eb3f78618d
commit 40c001739a
@@ -0,0 +1,33 @@
// imports
import { useMutation } from "@tanstack/vue-query";
import { API_ENDPOINTS } from "~/constants";
// types
export type SetOrderAddressRequest = {
address_id: number;
};
const useSetOrderAddress = () => {
// state
const { $axios: axios } = useNuxtApp();
// methods
const handleSetOrderAddress = async (params: SetOrderAddressRequest) => {
const { data } = await axios.post(
API_ENDPOINTS.orders.delivery.set_address,
{ ...params }
);
return data;
};
return useMutation({
mutationFn: (AddressData: SetOrderAddressRequest) =>
handleSetOrderAddress(AddressData),
});
};
export default useSetOrderAddress;