feat: add shipment management modal for admin

- Add ShipmentManagementModal component to manage shop shipment methods
- Add button to Shop settings page to open shipment management modal
- Update useShipmentData hooks to invalidate queries after add/remove operations
- Modal shows active and available shipment methods for admin to manage
This commit is contained in:
hamid zarghami
2025-10-27 11:14:13 +03:30
parent 4ed09f494f
commit cf3e2b7d4b
6 changed files with 260 additions and 3 deletions
+20
View File
@@ -4,6 +4,7 @@ import type {
CreateShipper,
Shipper,
ShipmentByIdResponse,
GetAdminShopResponse,
} from "../types/Types";
export const getShipment = async (
@@ -37,3 +38,22 @@ export const updateShipment = async (
const { data } = await axios.patch<Shipper>(`/admin/shipment/${id}`, params);
return data;
};
export const removeShipmentFromAdmin = async (id: string): Promise<void> => {
const { data } = await axios.post(`/admin/shipment/shipment/deactivate`, {
shipmentId: id,
});
return data;
};
export const addShipmentToAdmin = async (id: string): Promise<void> => {
const { data } = await axios.post(`/admin/shipment/shipment/activate`, {
shipmentId: id,
});
return data;
};
export const getAdminShop = async (): Promise<GetAdminShopResponse> => {
const { data } = await axios.get<GetAdminShopResponse>(`/admin/shop`);
return data;
};