mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 06:00:55 +00:00
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { api } from "../../auth/http";
|
|
|
|
export const containerService = {
|
|
async getContainers() {
|
|
const response = await api.get('/containers');
|
|
return response.data;
|
|
},
|
|
async getContainersByWagon(wagonId: string) {
|
|
const response = await api.get('/containers', { params: { wagonId } });
|
|
return response.data;
|
|
},
|
|
async createContainer(data: any) {
|
|
const response = await api.post('/containers', data);
|
|
return response.data;
|
|
},
|
|
async updateContainer(id: string, data: any) {
|
|
const response = await api.patch(`/containers/${id}`, data);
|
|
return response.data;
|
|
},
|
|
async deleteContainer(id: string) {
|
|
await api.delete(`/containers/${id}`);
|
|
},
|
|
async assignToWagon(containerId: string, wagonId: string, position?: number) {
|
|
const response = await api.post(`/containers/${containerId}/assign-wagon`, { wagonId, position });
|
|
return response.data;
|
|
},
|
|
async unassignFromWagon(containerId: string) {
|
|
const response = await api.post(`/containers/${containerId}/unassign-wagon`);
|
|
return response.data;
|
|
},
|
|
}; |