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:
@@ -46,3 +46,30 @@ export const useUpdateShipment = () => {
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const useRemoveShipmentFromAdmin = () => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => api.removeShipmentFromAdmin(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["admin-shop"] });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const useAddShipmentToAdmin = () => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => api.addShipmentToAdmin(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["admin-shop"] });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetAdminShop = () => {
|
||||
return useQuery({
|
||||
queryKey: ["admin-shop"],
|
||||
queryFn: () => api.getAdminShop(),
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user