Skip to content

Instantly share code, notes, and snippets.

@LarryKarani
Created April 9, 2020 22:29
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 LarryKarani/5e99946c13e304c85131609dc0b0b28d to your computer and use it in GitHub Desktop.
Save LarryKarani/5e99946c13e304c85131609dc0b0b28d to your computer and use it in GitHub Desktop.
// ACTION TYPES
export const API_REQUEST = 'API_REQUEST';
export const GET_TODO_SUCCESS = 'GET_TODO_SUCCESS';
export const GET_TODO_FAIL = 'GET_TODO_FAIL';
export const ADD_TODO_SUCCESS = 'ADD_TODO_SUCCESS';
export const ADD_TODO_FAIL = 'ADD_TODO_FAIL';
//ACTION CREATORS
export const apiRequestAction = () => ({
type: API_REQUEST
});
export const getTodoSuccess = todos => ({
type: API_REQUEST,
payload: todos
});
export const getTodosFail = error => ({
type: GET_TODO_FAIL,
payload: error
})
export const addTodoSuccess = todo => ({
type: ADD_TODO_SUCCESS,
payload: todo
})
export const addTodoFail = error => (
{
type: ADD_TODO_FAIL,
payload: error
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment