-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (47 loc) · 1.08 KB
/
Copy pathindex.js
File metadata and controls
54 lines (47 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import {
FETCH_CORONA_STATISTICS,
SHOW_COUNTRY_STATISTICS,
FETCH_MARKERS,
MAP_STYLE,
SET_ACTION,
BASE_URL,
SHOW_CHART
} from './constants';
export const dispatchStatistics = data => ({
type: FETCH_CORONA_STATISTICS,
payload: data
});
export const dispatchMarkers = data => ({
type: FETCH_MARKERS,
payload: data
});
export const fetchCoronaStatistics = () => dispatch => {
fetch(BASE_URL)
.then(response => response.json())
.then(data => {
dispatch(dispatchStatistics(data));
})
}
export const fetchMarkers = () => dispatch => {
fetch(BASE_URL+"markers.geojson")
.then(response => response.json())
.then(data => {
dispatch(dispatchMarkers(data));
})
}
export const showCountryStatistics = item => ({
type: SHOW_COUNTRY_STATISTICS,
payload: {item}
})
export const setMapStyle = style => ({
type: MAP_STYLE,
payload: {style}
})
export const setAction = action => ({
type: SET_ACTION,
payload: {action}
})
export const Showchart = value => ({
type: SHOW_CHART,
payload: value
})