Created
May 22, 2018 15:39
-
-
Save ravipatel2293/83cb07a702feb8e434826edf8ba12c81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { ADD_MOVIE } from './movie.actions'; | |
import { MovieStore } from './movie.store'; | |
@Injectable() | |
export class MovieReducers { | |
constructor(private _movieStore: MovieStore) { | |
} | |
movieReducer(action: any) { | |
switch (action.type) { | |
case ADD_MOVIE: | |
const newState = [...this._movieStore.movieStates, action.payload]; | |
this._movieStore.movieStore$.next(newState); | |
// default: | |
// return this._movieStore.movieStates; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment