comparison client/src/components/map/fairway/Profiles.vue @ 1377:fa7d647f8d77

added timestamp to saved cross profiles
author Markus Kottlaender <markus@intevation.de>
date Tue, 27 Nov 2018 13:29:10 +0100
parents 553aadd97087
children da44c669c9f5
comparison
equal deleted inserted replaced
1376:e27176811d2f 1377:fa7d647f8d77
300 const previousCuts = 300 const previousCuts =
301 JSON.parse(localStorage.getItem("previousCuts")) || []; 301 JSON.parse(localStorage.getItem("previousCuts")) || [];
302 const newEntry = { 302 const newEntry = {
303 label: this.cutLabel, 303 label: this.cutLabel,
304 bottleneckName: this.selectedBottleneck, 304 bottleneckName: this.selectedBottleneck,
305 coordinates: [...this.startPoint, ...this.endPoint] 305 coordinates: [...this.startPoint, ...this.endPoint],
306 timestamp: new Date().getTime()
306 }; 307 };
307 const existingEntry = previousCuts.find(cut => { 308 const existingEntry = previousCuts.find(cut => {
308 return JSON.stringify(cut) === JSON.stringify(newEntry); 309 return JSON.stringify(cut) === JSON.stringify(newEntry);
309 }); 310 });
310 if (!existingEntry) previousCuts.push(newEntry); 311 if (!existingEntry) previousCuts.push(newEntry);