Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {NEW_GOING,NEW_PARTICIPANT,NEW_PLAN,NEW_PLANNER,PARTICIPANT_UNREGISTERED,PLAN_DELETED,PLANNER_UNREGISTERED} from './actions';
- import {tassign} from "tassign";
- import {Injector} from "@angular/core";
- export interface IAppState {
- planner: number;
- participant: number;
- plans: number;
- }
- export class Class {
- }
- export const INITIAL_STATE: IAppState = {
- planner: 1,
- participant: 1,
- plans: 8,
- };
- export function rootReducer(state: IAppState, action): IAppState{
- switch (action.type) {
- case NEW_PLANNER:
- return tassign(state, {planner: state.planner + 1});
- case NEW_PLAN:
- return tassign(state, {plans: state.plans + 1});
- case PLAN_DELETED:
- return tassign(state, {plans: state.plans - 1});
- }
- return state;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement