Store: make global fetch count tracking generic.

master
Tom Hacohen 7 years ago
parent c6ec2bcaf1
commit 57f89e3840

@ -96,9 +96,7 @@ function credentials(state: CredentialsType = {status: FetchStatus.Initial, valu
} }
function fetchCount(state: number = 0, action: any) { function fetchCount(state: number = 0, action: any) {
// FIXME: Make it automatic by action properties. if ('status' in action) {
switch (action.type) {
case Actions.FETCH_CREDENTIALS:
switch (action.status) { switch (action.status) {
case FetchStatus.Request: case FetchStatus.Request:
return state + 1; return state + 1;
@ -108,6 +106,8 @@ function fetchCount(state: number = 0, action: any) {
default: default:
return state; return state;
} }
}
switch (action.type) {
default: default:
return state; return state;
} }

Loading…
Cancel
Save