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:
Vendored
+29
@@ -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}`, {
|
||||
|
||||
Reference in New Issue
Block a user