2023-03-31 12:54:15 +00:00
|
|
|
import { defineStore } from 'pinia';
|
|
|
|
// import axios from 'axios';
|
|
|
|
|
|
|
|
export const MapService = defineStore('map', {
|
|
|
|
state: () => ({
|
|
|
|
// dataset: {} as Dataset,
|
|
|
|
|
|
|
|
mapService: new Map<string, any>(),
|
|
|
|
}),
|
|
|
|
actions: {
|
|
|
|
// payload = authenticated user
|
|
|
|
setUser(payload) {
|
|
|
|
if (payload.name) {
|
|
|
|
this.userName = payload.name;
|
|
|
|
}
|
|
|
|
if (payload.email) {
|
|
|
|
this.userEmail = payload.email;
|
|
|
|
}
|
|
|
|
if (payload.avatar) {
|
|
|
|
this.userAvatar = payload.avatar;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-04-06 16:56:41 +00:00
|
|
|
getMap(id: string) {
|
2023-03-31 12:54:15 +00:00
|
|
|
return this.mapService.get(id);
|
|
|
|
},
|
|
|
|
|
2023-06-27 16:23:18 +00:00
|
|
|
setMap(id: string, map) {
|
|
|
|
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);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|