Skip to content
Snippets Groups Projects
Commit ae11651e authored by Chif Gergő's avatar Chif Gergő
Browse files

Create actions to get events from backend

parent b72b9948
No related branches found
No related tags found
No related merge requests found
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);
}
}
);
...@@ -10,3 +10,5 @@ export const ADD_NEWS = 'add_news'; ...@@ -10,3 +10,5 @@ export const ADD_NEWS = 'add_news';
export const DELETE_NEWS = 'delete_news'; export const DELETE_NEWS = 'delete_news';
export const EDIT_NEWS = 'edit_news'; export const EDIT_NEWS = 'edit_news';
export const SELECT_NEWS = 'select_news'; export const SELECT_NEWS = 'select_news';
export const GET_EVENTS = 'get_events';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment