import axios from "../../../config/axios"; import type { ShipmentResponse, CreateShipper, Shipper, ShipmentByIdResponse, GetAdminShopResponse, } from "../types/Types"; export const getShipment = async ( page: number = 1 ): Promise => { const { data } = await axios.get(`/shipment?page=${page}`); return data; }; export const createShipment = async (data: CreateShipper): Promise => { const response = await axios.post("/admin/shipment", data); return response.data; }; export const deleteShipment = async (id: string): Promise => { const { data } = await axios.delete(`/admin/shipment/${id}`); return data; }; export const getShipmentById = async (id: string): Promise => { const { data } = await axios.get( `/admin/shipment/${id}` ); return data.results.shipper; }; export const updateShipment = async ( id: string, params: CreateShipper ): Promise => { const { data } = await axios.patch(`/admin/shipment/${id}`, params); return data; }; export const removeShipmentFromAdmin = async (id: number): Promise => { const { data } = await axios.patch(`/admin/shipment/deactivate`, { shipmentId: id, }); return data; }; export const addShipmentToAdmin = async (id: number): Promise => { const { data } = await axios.patch(`/admin/shipment/activate`, { shipmentId: id, }); return data; }; export const getAdminShop = async (): Promise => { const { data } = await axios.get(`/admin/shop`); return data; };