export function fetchTodoList(){ var request = fetch('API-URL',{ method: 'GET', headers:{ 'Content-Type': 'application/json', 'x-api-key': 'API-KEY' } }) .then(response => response.json()) .then((data) => { return data; } ) .catch(error => console.log('Error while fetching:', error)); return ({ type:ActionTypes.FETCH_TODOLIST, payload:request }) }