Sửa đổi dữ liệu của hệ thống theo ARCHITECTURE.md

This commit is contained in:
2026-06-13 19:52:08 +07:00
parent 7fc80a49d0
commit b54707823c
33 changed files with 655 additions and 275 deletions
+5 -4
View File
@@ -7,14 +7,15 @@ export const useTourStore = create((set, get) => ({
setTour: (tour) => set({ currentTour: tour }),
updateLegs: (legs) => set({ legs }),
fetchTour: async (id) => {
const currentUserId = 1;
const response = await fetch(`http://localhost:3001/api/v1/tours/${id}`);
const API_BASE = `http://${window.location.hostname}:3001`;
const response = await fetch(`${API_BASE}/api/v1/tours/${id}`);
const data = await response.json();
const role = data.members?.find((m) => m.userId === currentUserId)?.role || 'VIEWER_EXTERNAL';
const role = data.participants?.[0]?.role || 'VIEWER_ONLY';
set({ currentTour: data, legs: data.legs || [], userRole: role });
},
fetchPublicTours: async () => {
const response = await fetch(`http://localhost:3001/api/v1/tours/explore`);
const API_BASE = `http://${window.location.hostname}:3001`;
const response = await fetch(`${API_BASE}/api/v1/tours/explore`);
const data = await response.json();
set({ publicTours: data });
},