update shipment
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user