Sửa hiển thị điểm đầu và điểm cuối của chặng

This commit is contained in:
2026-06-14 09:28:33 +07:00
parent ed437cdb0f
commit 14bf43487e
17 changed files with 189 additions and 12 deletions
+14
View File
@@ -85,6 +85,20 @@ export const useTourStore = create((set, get) => ({
throw new Error('Lỗi khi thêm chặng');
get().fetchTour(tourId);
},
initializeLegs: async (tourId, count) => {
const API_BASE = `http://${window.location.hostname}:3001`;
const response = await fetch(`${API_BASE}/api/v1/tours/${tourId}/legs/batch`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${localStorage.getItem('token')}`
},
body: JSON.stringify({ count }),
});
if (!response.ok)
throw new Error('Lỗi khi khởi tạo chặng');
await get().fetchTour(tourId);
},
updateLeg: async (legId, data) => {
const API_BASE = `http://${window.location.hostname}:3001`;
const response = await fetch(`${API_BASE}/api/v1/legs/${legId}`, {