Thêm tính năng trong mục 4.1 của ARCHITECTURE.md

This commit is contained in:
2026-06-13 20:14:52 +07:00
parent b54707823c
commit c51ddc34c7
13 changed files with 343 additions and 60 deletions
+11 -1
View File
@@ -19,7 +19,17 @@ export const useTourStore = create((set, get) => ({
const data = await response.json();
set({ publicTours: data });
},
optimizeRouting: async () => {
optimizeRouting: async (legId) => {
const API_BASE = `http://${window.location.hostname}:3001`;
const response = await fetch(`${API_BASE}/api/v1/routing/optimize/${legId}`, {
method: 'POST'
});
const { locations, totalDistance } = await response.json();
const { currentTour } = get();
if (currentTour) {
const updatedLegs = currentTour.legs.map((l) => l.id === legId ? { ...l, locations: locations, totalDistance: totalDistance } : l);
set({ currentTour: { ...currentTour, legs: updatedLegs }, legs: updatedLegs });
}
},
}));
//# sourceMappingURL=useTourStore.js.map