@@ -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