diff --git a/src/actions/statistics.js b/src/actions/statistics.js new file mode 100644 index 0000000000000000000000000000000000000000..f4d9d8e0f879f946d218622189fd69f29b4f4718 --- /dev/null +++ b/src/actions/statistics.js @@ -0,0 +1,16 @@ +import { axios } from './auth'; +import { GET_EVENTS } from './types'; + +export const getEvents = () => ( + async (dispatch) => { + try { + const response = await axios.get('/api/v1/events'); + dispatch({ + type: GET_EVENTS, + payload: response.data, + }); + } catch (e) { + console.log(e); + } + } +); diff --git a/src/actions/types.js b/src/actions/types.js index 177bbd756bb8212baabdd05a82dd959c67c65514..5d962535d0438c1151f58e70835c587280b297ba 100644 --- a/src/actions/types.js +++ b/src/actions/types.js @@ -10,3 +10,5 @@ export const ADD_NEWS = 'add_news'; export const DELETE_NEWS = 'delete_news'; export const EDIT_NEWS = 'edit_news'; export const SELECT_NEWS = 'select_news'; + +export const GET_EVENTS = 'get_events';