Skip to content

Commit f053b86

Browse files
authored
Enable reactivity in covidcast form (#85)
1 parent f9a3a19 commit f053b86

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/components/dialogs/dataSources/COVIDcast.svelte

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
import { apiKey, formSelections } from '../../../store';
88
99
export let id: string;
10-
let data_source = $formSelections.covidcast.dataSource;
11-
let signal = $formSelections.covidcast.signal;
12-
let geo_type = $formSelections.covidcast.geoType;
13-
let geo_value = $formSelections.covidcast.geoValue;
1410
let valid_key = true;
1511
1612
let dataSources: (LabelValue & { signals: string[] })[] = [];
1713
let geoTypes: string[] = [];
1814
19-
$: dataSignals = (dataSources.find((d) => d.value === data_source) || { signals: [] }).signals;
15+
$: dataSignals = (dataSources.find((d) => d.value === $formSelections.covidcast.dataSource) || { signals: [] })
16+
.signals;
2017
2118
$: {
2219
if ($formSelections.covidcast.dataSource) {
@@ -68,9 +65,19 @@
6865
6966
export function importDataSet() {
7067
return fetchCOVIDcastMeta($apiKey).then((res) => {
71-
const meta = res.filter((row) => row.data_source === data_source && row.signal === signal);
68+
const meta = res.filter(
69+
(row) =>
70+
row.data_source === $formSelections.covidcast.dataSource && row.signal === $formSelections.covidcast.signal,
71+
);
7272
const time_type = meta[0].time_type;
73-
return importCOVIDcast({ data_source, signal, geo_type, geo_value, time_type, api_key: $apiKey });
73+
return importCOVIDcast({
74+
data_source: $formSelections.covidcast.dataSource,
75+
geo_type: $formSelections.covidcast.geoType,
76+
geo_value: $formSelections.covidcast.geoValue,
77+
signal: $formSelections.covidcast.signal,
78+
time_type,
79+
api_key: $apiKey,
80+
});
7481
});
7582
}
7683
</script>

0 commit comments

Comments
 (0)