Skip to content

Instantly share code, notes, and snippets.

@davelosert
Last active October 13, 2017 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davelosert/dc7121324fcac1899c21c0f467c12f0c to your computer and use it in GitHub Desktop.
Save davelosert/dc7121324fcac1899c21c0f467c12f0c to your computer and use it in GitHub Desktop.
import {loadingTodos, loadTodosSuccess} from '../state/todo.actions';
export const fetchAllTodos = () =>
(dispatch, getState, todoRepository: TodoRepository) => {
dispatch(loadingTodos());
fetch('https://jsonplaceholder.typicode.com/todos')
.then(result => result.json())
.then(todos => dispatch(loadTodosSuccess(todos)))
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment