Advertisement
Guest User

Untitled

a guest
Jan 8th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {NEW_GOING,NEW_PARTICIPANT,NEW_PLAN,NEW_PLANNER,PARTICIPANT_UNREGISTERED,PLAN_DELETED,PLANNER_UNREGISTERED} from './actions';
  2. import {tassign} from "tassign";
  3. import {Injector} from "@angular/core";
  4.  
  5. export interface IAppState {
  6.   planner: number;
  7.   participant: number;
  8.   plans: number;
  9. }
  10.  
  11. export class Class {
  12.  
  13. }
  14.  
  15. export const INITIAL_STATE: IAppState = {
  16.  
  17.   planner: 1,
  18.   participant: 1,
  19.   plans: 8,
  20. };
  21.  
  22.  
  23. export function rootReducer(state: IAppState, action): IAppState{
  24.   switch (action.type) {
  25.     case NEW_PLANNER:
  26.       return tassign(state, {planner: state.planner + 1});
  27.  
  28.     case NEW_PLAN:
  29.       return tassign(state, {plans: state.plans + 1});
  30.  
  31.     case PLAN_DELETED:
  32.       return tassign(state, {plans: state.plans - 1});
  33.  
  34.  
  35.  
  36.   }
  37.   return state;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement