Sửa lỗi hiển thị điểm đầu và điểm cuối của lộ trình trên bản đồ

This commit is contained in:
2026-06-14 09:06:51 +07:00
parent c7db2c3ed8
commit ed437cdb0f
16 changed files with 783 additions and 163 deletions
+29
View File
@@ -131,6 +131,35 @@ export const useTourStore = create((set, get) => ({
throw new Error('Lỗi khi thêm địa điểm');
get().fetchTour(tourId);
},
updateTourStartPoint: async (tourId, data) => {
const API_BASE = `http://${window.location.hostname}:3001`;
const response = await fetch(`${API_BASE}/api/v1/tours/${tourId}/start-point`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${localStorage.getItem('token')}`
},
body: JSON.stringify(data),
});
console.log(`[STORE] updateTourStartPoint API Status: ${response.status}`);
if (!response.ok)
throw new Error('Lỗi khi thiết lập điểm bắt đầu');
await get().fetchTour(tourId);
},
updateTourEndPoint: async (tourId, data) => {
const API_BASE = `http://${window.location.hostname}:3001`;
const response = await fetch(`${API_BASE}/api/v1/tours/${tourId}/end-point`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${localStorage.getItem('token')}`
},
body: JSON.stringify(data),
});
if (!response.ok)
throw new Error('Lỗi khi thiết lập điểm kết thúc');
await get().fetchTour(tourId);
},
optimizeRouting: async (legId) => {
const API_BASE = `http://${window.location.hostname}:3001`;
const response = await fetch(`${API_BASE}/api/v1/routing/optimize/${legId}`, {