1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1x 1x 3x 5x 14x 7x 7x 3x 3x 3x 3x 1x 6x | export const SHOW = 'loading-bar/SHOW'
export const HIDE = 'loading-bar/HIDE'
export function showLoading() {
return {
type: SHOW,
}
}
export function hideLoading() {
return {
type: HIDE,
}
}
export function loadingBarReducer(state = 0, action = {}) {
let newState
switch (action.type) {
case SHOW:
newState = state + 1
break
case HIDE:
newState = state > 0 ? state - 1 : 0
break
default:
return state
}
return newState
}
|