fix: remove /api prefix from layoutApi paths (base URL already includes /api)
This commit is contained in:
parent
96c7a2bf75
commit
935ff4dace
1 changed files with 16 additions and 15 deletions
|
|
@ -81,24 +81,24 @@ export interface LayoutSection {
|
||||||
export const layoutApi = {
|
export const layoutApi = {
|
||||||
// Properties
|
// Properties
|
||||||
async getProperties(): Promise<LayoutProperty[]> {
|
async getProperties(): Promise<LayoutProperty[]> {
|
||||||
const response = await api.get('/api/layout/properties');
|
const response = await api.get('/layout/properties');
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
async createProperty(data: { name: string; address?: string; licenseNum?: string }): Promise<LayoutProperty> {
|
async createProperty(data: { name: string; address?: string; licenseNum?: string }): Promise<LayoutProperty> {
|
||||||
const response = await api.post('/api/layout/properties', data);
|
const response = await api.post('/layout/properties', data);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Buildings
|
// Buildings
|
||||||
async createBuilding(data: { propertyId: string; name: string; code: string; type: string }): Promise<LayoutBuilding> {
|
async createBuilding(data: { propertyId: string; name: string; code: string; type: string }): Promise<LayoutBuilding> {
|
||||||
const response = await api.post('/api/layout/buildings', data);
|
const response = await api.post('/layout/buildings', data);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Floors
|
// Floors
|
||||||
async getFloor(id: string): Promise<LayoutFloor & { building: LayoutBuilding }> {
|
async getFloor(id: string): Promise<LayoutFloor & { building: LayoutBuilding }> {
|
||||||
const response = await api.get(`/api/layout/floors/${id}`);
|
const response = await api.get(`/layout/floors/${id}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ export const layoutApi = {
|
||||||
ceilingHeight?: number;
|
ceilingHeight?: number;
|
||||||
defaultTiers?: number;
|
defaultTiers?: number;
|
||||||
}): Promise<LayoutFloor> {
|
}): Promise<LayoutFloor> {
|
||||||
const response = await api.post('/api/layout/floors', data);
|
const response = await api.post('/layout/floors', data);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -129,52 +129,53 @@ export const layoutApi = {
|
||||||
rotation: r.rotation,
|
rotation: r.rotation,
|
||||||
sections: r.sections // Include sections in save
|
sections: r.sections // Include sections in save
|
||||||
}));
|
}));
|
||||||
const response = await api.post(`/api/layout/floors/${floorId}/layout`, { rooms: roomsForApi });
|
const response = await api.post(`/layout/floors/${floorId}/layout`, { rooms: roomsForApi });
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Rooms
|
// Rooms
|
||||||
async createRoom(data: Partial<LayoutRoom>): Promise<LayoutRoom> {
|
async createRoom(data: Partial<LayoutRoom>): Promise<LayoutRoom> {
|
||||||
const response = await api.post('/api/layout/rooms', data);
|
const response = await api.post('/layout/rooms', data);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateRoom(id: string, data: Partial<LayoutRoom>): Promise<LayoutRoom> {
|
async updateRoom(id: string, data: Partial<LayoutRoom>): Promise<LayoutRoom> {
|
||||||
const response = await api.put(`/api/layout/rooms/${id}`, data);
|
const response = await api.put(`/layout/rooms/${id}`, data);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
async deleteRoom(id: string): Promise<void> {
|
async deleteRoom(id: string): Promise<void> {
|
||||||
await api.delete(`/api/layout/rooms/${id}`);
|
await api.delete(`/layout/rooms/${id}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Sections
|
// Sections
|
||||||
async createSection(data: Partial<LayoutSection> & { rows: number; columns: number }): Promise<LayoutSection> {
|
async createSection(data: Partial<LayoutSection> & { rows: number; columns: number }): Promise<LayoutSection> {
|
||||||
const response = await api.post('/api/layout/sections', data);
|
const response = await api.post('/layout/sections', data);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
async getRoomSections(roomId: string): Promise<LayoutSection[]> {
|
async getRoomSections(roomId: string): Promise<LayoutSection[]> {
|
||||||
const response = await api.get(`/api/layout/rooms/${roomId}/sections`);
|
const response = await api.get(`/layout/rooms/${roomId}/sections`);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
async placeBatchInPosition(positionId: string, batchId: string): Promise<void> {
|
async placeBatchInPosition(positionId: string, batchId: string): Promise<void> {
|
||||||
await api.post(`/api/layout/positions/${positionId}/occupy`, { batchId });
|
await api.post(`/layout/positions/${positionId}/occupy`, { batchId });
|
||||||
},
|
},
|
||||||
|
|
||||||
async fillSection(sectionId: string, batchId: string, maxCount?: number): Promise<{ plantsCreated: number; message: string }> {
|
async fillSection(sectionId: string, batchId: string, maxCount?: number): Promise<{ plantsCreated: number; message: string }> {
|
||||||
const response = await api.post(`/api/layout/sections/${sectionId}/fill`, { batchId, maxCount });
|
const response = await api.post(`/layout/sections/${sectionId}/fill`, { batchId, maxCount });
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
async movePlant(plantId: string, targetPositionId: string, reason?: string): Promise<{ newAddress: string; message: string }> {
|
async movePlant(plantId: string, targetPositionId: string, reason?: string): Promise<{ newAddress: string; message: string }> {
|
||||||
const response = await api.post(`/api/layout/plants/${plantId}/move`, { targetPositionId, reason });
|
const response = await api.post(`/layout/plants/${plantId}/move`, { targetPositionId, reason });
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
async getSection(id: string): Promise<LayoutSection> {
|
async getSection(id: string): Promise<LayoutSection> {
|
||||||
const response = await api.get(`/api/layout/sections/${id}`);
|
const response = await api.get(`/layout/sections/${id}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue