ekangularbase
Version:
Authentication service for usermanagement(oidc client)
25 lines (19 loc) • 523 B
text/typescript
import { Action } from '../../../@ngrx/store';
export const INCREMENT = 'INCREMENT';
export const DECREMENT = 'DECREMENT';
export const RESET = 'RESET';
export function counterReducer(state: number = 0, action: Action) {
switch (action.type) {
case INCREMENT:
return state + 1;
case DECREMENT:
return state - 1;
case RESET:
return 0;
default:
{
if (parseInt(action.type, 10) >= 0) return parseInt(action.type, 10);
else return 0;
}
}
}