Sửa hiển thị điểm đầu và điểm cuối của chặng
This commit is contained in:
Vendored
+14
@@ -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}`, {
|
||||
|
||||
Reference in New Issue
Block a user