update shipment

This commit is contained in:
hamid zarghami
2025-09-29 11:47:35 +03:30
parent 53859d4bbb
commit 25148282ae
5 changed files with 313 additions and 1 deletions
+21 -1
View File
@@ -1,5 +1,10 @@
import axios from "../../../config/axios";
import type { ShipmentResponse, CreateShipper, Shipper } from "../types/Types";
import type {
ShipmentResponse,
CreateShipper,
Shipper,
ShipmentByIdResponse,
} from "../types/Types";
export const getShipment = async (
page: number = 1
@@ -17,3 +22,18 @@ export const deleteShipment = async (id: string): Promise<void> => {
const { data } = await axios.delete(`/admin/shipment/${id}`);
return data;
};
export const getShipmentById = async (id: string): Promise<Shipper> => {
const { data } = await axios.get<ShipmentByIdResponse>(
`/admin/shipment/${id}`
);
return data.results.shipper;
};
export const updateShipment = async (
id: string,
params: CreateShipper
): Promise<Shipper> => {
const { data } = await axios.patch<Shipper>(`/admin/shipment/${id}`, params);
return data;
};