Skip to content

Commit 7dbe224

Browse files
committed
Consider null sensor
1 parent 8771297 commit 7dbe224

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/modes/indicator/IndicatorAbout.svelte

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717
*/
1818
export let sensor;
1919
20-
function exportData() {
21-
sensor.set(sensor.value);
20+
function setExportMode() {
2221
// switch to export mode
2322
currentMode.set(modeByID.export);
2423
}
2524
2625
function buildExportURL() {
2726
let exportURL = '';
28-
if (sensor.key.split('-').length >= 2) {
27+
if (sensor && sensor.key.split('-').length >= 2) {
2928
// account for dashes in the sensor
3029
let [first, ...rest] = sensor.key.split('-');
3130
rest = rest.join('-');
@@ -35,7 +34,6 @@
3534
exportURL += `&geo_type=${region.level}&geo_value=${region.propertyId}`;
3635
}
3736
if (date) {
38-
console.log(date);
3937
exportURL += `&start_day=${formatDateISO(date.value)}&end_day=${formatDateISO(date.value)}`;
4038
}
4139
return exportURL;
@@ -60,9 +58,7 @@
6058
</li>
6159
{/each}
6260
<li>
63-
<a href={`../${modeByID.export.id}/?${buildExportURL()}`} on:click|preventDefault={exportData}
64-
>Export Data</a
65-
>
61+
<a href={`../export/?${buildExportURL()}`} on:click={setExportMode}>Export Data</a>
6662
</li>
6763
</ul>
6864
{/if}

0 commit comments

Comments
 (0)