reducer
This file contains 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