2023-03-31 12:54:15 +00:00
|
|
|
import { defineStore } from 'pinia';
|
|
|
|
// import axios from 'axios';
|
2023-04-06 16:56:41 +00:00
|
|
|
// import dayjs from 'dayjs';
|
2024-03-14 19:25:27 +00:00
|
|
|
import type { Map as LeafletMap } from 'leaflet' ;
|
2023-03-31 12:54:15 +00:00
|
|
|
|
2023-04-06 16:56:41 +00:00
|
|
|
export const TimeService = defineStore('map', {
|
2023-06-27 16:23:18 +00:00
|
|
|
state: () => ({
|
2023-03-31 12:54:15 +00:00
|
|
|
// dataset: {} as Dataset,
|
|
|
|
mapService: new Map<string, any>(),
|
|
|
|
}),
|
2023-06-27 16:23:18 +00:00
|
|
|
actions: {
|
2023-04-06 16:56:41 +00:00
|
|
|
getMap(id: string) {
|
2023-03-31 12:54:15 +00:00
|
|
|
return this.mapService.get(id);
|
|
|
|
},
|
|
|
|
|
2024-03-14 19:25:27 +00:00
|
|
|
setMap(id: string, map: LeafletMap) {
|
2023-06-27 16:23:18 +00:00
|
|
|
this.mapService.set(id, map);
|
2023-03-31 12:54:15 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
hasMap(id: string): boolean {
|
|
|
|
return this.mapService.has(id);
|
|
|
|
},
|
2023-06-27 16:23:18 +00:00
|
|
|
|
2023-03-31 12:54:15 +00:00
|
|
|
deleteMap(id: string): boolean {
|
|
|
|
return this.mapService.delete(id);
|
|
|
|
},
|
|
|
|
|
2023-04-06 16:56:41 +00:00
|
|
|
// getDuration(timespan: Timespan): dayjs. {
|
|
|
|
// const from = dayjs(timespan.from);
|
|
|
|
// const to = dayjs(timespan.to);
|
|
|
|
// return dayjs.duration(to.diff(from));
|
|
|
|
// },
|
2023-03-31 12:54:15 +00:00
|
|
|
},
|
|
|
|
});
|