Skip to content

Commit 57fef05

Browse files
committed
only allow known snapshots in workspace
1 parent b0461b3 commit 57fef05

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

vue/src/views/Workspace.vue

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,18 @@ export default {
174174
}
175175
});
176176
if (result.data.hasOwnProperty('workspace') && result.data.workspace) {
177-
const workspaceData = result.data.workspace;
178-
const snapshotData = result.data.snapshot;
179-
this.geojson = snapshotData.data;
180-
this.municipalityName = snapshotData.municipality.fullname;
181-
this.snapshotsWorkspace = workspaceData.snapshots;
182-
this.title = workspaceData.title;
183-
this.description = workspaceData.description;
184-
this.$store.commit('setBfsnumber', snapshotData.municipality.bfsNumber);
185-
this.$store.commit('setBfsname', snapshotData.municipality.fullname);
177+
const workspace = result.data.workspace;
178+
const snapshot = result.data.snapshot;
179+
if (!workspace.snapshots.map(s => s.pk).includes(snapshot.pk)) {
180+
this.$router.push({ name: 'home' });
181+
}
182+
this.geojson = snapshot.data;
183+
this.municipalityName = snapshot.municipality.fullname;
184+
this.snapshotsWorkspace = workspace.snapshots;
185+
this.title = workspace.title;
186+
this.description = workspace.description;
187+
this.$store.commit('setBfsnumber', snapshot.municipality.bfsNumber);
188+
this.$store.commit('setBfsname', snapshot.municipality.fullname);
186189
} else {
187190
this.$router.push({ name: 'home' });
188191
}

0 commit comments

Comments
 (0)