1
1
<template >
2
- <div
3
- :class =" { inactive: store.isColored }"
4
- class =" mapcontainer"
5
- id =" map"
6
- ></div >
2
+ <div :class =" { inactive: store.isColored }" class =" mapcontainer" id =" map" ></div >
7
3
<Footer
8
4
:currentProvider =" provider"
9
5
:canHistory =" historyready"
25
21
<script >
26
22
import { useStore } from " @/store" ;
27
23
import Footer from " ../components/footer/Footer.vue" ;
28
- import config from " ../config" ;
29
- import {
30
- drawuser ,
31
- init ,
32
- removeMap ,
33
- setTheme ,
34
- setview ,
35
- } from " ../utils/map/instance" ;
24
+ import { drawuser , init , removeMap , setTheme , setview } from " ../utils/map/instance" ;
36
25
import { init as initMarkers } from " ../utils/map/marker" ;
37
26
import { init as initWind } from " ../utils/map/wind" ;
27
+ import { getTypeProvider } from " ../utils/utils" ;
38
28
39
29
export default {
40
30
emits: [" city" , " clickMarker" , " close" ],
@@ -44,9 +34,7 @@ export default {
44
34
return {
45
35
store: useStore (),
46
36
locale: localStorage .getItem (" locale" ) || this .$i18n .locale || " en" ,
47
- theme: window ? .matchMedia (" (prefers-color-scheme: light)" ).matches
48
- ? " light"
49
- : " dark" ,
37
+ theme: window ? .matchMedia (" (prefers-color-scheme: light)" ).matches ? " light" : " dark" ,
50
38
userposition: null ,
51
39
geoavailable: false ,
52
40
};
@@ -63,7 +51,7 @@ export default {
63
51
return this .store .mapposition .lng ;
64
52
},
65
53
provider () {
66
- return this . $route . params . provider || config . DEFAUL_TYPE_PROVIDER ;
54
+ return getTypeProvider () ;
67
55
},
68
56
},
69
57
@@ -87,7 +75,7 @@ export default {
87
75
const options = {
88
76
name: " main" ,
89
77
params: {
90
- provider: this . provider || config . DEFAUL_TYPE_PROVIDER ,
78
+ provider: getTypeProvider () ,
91
79
type: this .$route .params .type || " pm10" ,
92
80
zoom: zoom,
93
81
lat: lat,
@@ -97,7 +85,6 @@ export default {
97
85
};
98
86
99
87
if (this .$router .currentRoute .value .name === " main" ) {
100
- console .log (options);
101
88
/* added here check for current route is map (main), as it caused problems with other pages */
102
89
if (type === " reload" ) {
103
90
this .$router .push (options).catch ((e ) => {
@@ -128,16 +115,9 @@ export default {
128
115
if (" geolocation" in navigator ) {
129
116
navigator .geolocation .getCurrentPosition (
130
117
(position ) => {
131
- this .userposition = [
132
- position .coords .latitude ,
133
- position .coords .longitude ,
134
- ];
118
+ this .userposition = [position .coords .latitude , position .coords .longitude ];
135
119
/* setting for the app globally user's geo position and zoom 20 for better view */
136
- this .store .setmapposition (
137
- this .userposition [0 ],
138
- this .userposition [1 ],
139
- 20
140
- );
120
+ this .store .setmapposition (this .userposition [0 ], this .userposition [1 ], 20 );
141
121
this .geoavailable = true ;
142
122
resolve ();
143
123
},
0 commit comments