main create
This commit is contained in:
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
"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
|
||||
Reference in New Issue
Block a user