Skip to content

Commit bea4a5e

Browse files
committed
split map and sidebar loading for snapshotview
1 parent 9efe778 commit bea4a5e

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

vue/src/views/Snapshot.vue

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ export default {
149149
150150
async mounted() {
151151
if (this.hash) {
152-
await this.getSnapshot(this.hash);
152+
await this.getSnapshotInfo(this.hash);
153+
154+
await this.getSnapshotData(this.hash);
153155
if (this.geojson) {
154156
this.$refs.map.setupMeta();
155157
this.$refs.map.setupMapbox();
@@ -192,13 +194,12 @@ export default {
192194
},
193195
194196
methods: {
195-
async getSnapshot(hash) {
197+
async getSnapshotInfo(hash) {
196198
const result = await this.$apollo.query({
197199
query: gql`query getsnapshot($hash: ID!) {
198200
snapshot(id: $hash) {
199201
id
200202
pk
201-
data
202203
predecessor {
203204
id
204205
pk
@@ -238,7 +239,6 @@ export default {
238239
});
239240
if (result) {
240241
if (result.data.hasOwnProperty('snapshot') && result.data.snapshot) {
241-
this.geojson = result.data.snapshot.data;
242242
this.municipalityName = result.data.snapshot.municipality.fullname;
243243
this.snapshotsMunicipality = result.data.snapshot.municipality.snapshots;
244244
const snapshotsIdExamplesExclude = this.snapshotsMunicipality.map(
@@ -258,6 +258,30 @@ export default {
258258
}
259259
},
260260
261+
async getSnapshotData(hash) {
262+
const result = await this.$apollo.query({
263+
query: gql`query getsnapshot($hash: ID!) {
264+
snapshot(id: $hash) {
265+
id
266+
pk
267+
data
268+
}
269+
}`,
270+
variables: {
271+
hash: btoa(`SnapshotNode:${hash}`)
272+
}
273+
}).catch((error) => {
274+
this.errorsettings = { type: 'netwokerror', open: true, error };
275+
});
276+
if (result) {
277+
if (result.data.hasOwnProperty('snapshot') && result.data.snapshot) {
278+
this.geojson = result.data.snapshot.data;
279+
} else {
280+
this.$router.push({ name: 'home' });
281+
}
282+
}
283+
},
284+
261285
async getEmpty(bfsNumber) {
262286
const result = await this.$apollo.query({
263287
query: gql`query getmunicipality($bfsNumber: ID!) {

0 commit comments

Comments
 (0)