Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
Created April 5, 2020 23:32
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 davidgilbertson/1b883ce2f2a1b49366ea4ae022786f8f to your computer and use it in GitHub Desktop.
Save davidgilbertson/1b883ce2f2a1b49366ea4ae022786f8f to your computer and use it in GitHub Desktop.
const loadTodos = () => async (dispatch, getState) => {
const userId = getState().user.id;
const todos = await fetch(`/api/todos/${userId}`).then((resp) => resp.json());
dispatch({
type: 'LOADED_TODOS',
data: todos,
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment