21 lines
819 B
JavaScript
21 lines
819 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.useTourStore = void 0;
|
|
const zustand_1 = require("zustand");
|
|
exports.useTourStore = (0, zustand_1.create)((set, get) => ({
|
|
currentTour: null,
|
|
legs: [],
|
|
userRole: null,
|
|
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 data = await response.json();
|
|
const role = data.members?.find((m) => m.userId === currentUserId)?.role || 'VIEWER_EXTERNAL';
|
|
set({ currentTour: data, legs: data.legs || [], userRole: role });
|
|
},
|
|
optimizeRouting: async () => {
|
|
},
|
|
}));
|
|
//# sourceMappingURL=useTourStore.js.map
|