-
-
Save ramzes13/ff150c812ca04810c73c406cb08794d9 to your computer and use it in GitHub Desktop.
reducer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const configs = (state: BookListsInterface = defaultState, action: any): BookListsInterface => { | |
switch (action.type) { | |
case bookListActions.BOOK_LIST_BEGIN_LOADING: { | |
const { loadingMeta } = state; | |
loadingMeta.isLoading += 1; | |
return { ...state, loadingMeta: Object.assign({}, loadingMeta) }; | |
} | |
case bookListActions.BOOK_LIST_END_LOADING: { | |
const { loadingMeta } = state; | |
loadingMeta.isLoading -= 1; | |
loadingMeta.lastLoad = new Date(); | |
return { ...state, loadingMeta: Object.assign({}, loadingMeta) }; | |
} | |
case bookListActions.BOOK_LIST_SET_BOOK_LIST: { | |
// todo implement | |
return { ...state }; | |
} | |
default: | |
return state | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment