Skip to content

Instantly share code, notes, and snippets.

@ravipatel2293
Created May 22, 2018 15:39
Show Gist options
  • Save ravipatel2293/83cb07a702feb8e434826edf8ba12c81 to your computer and use it in GitHub Desktop.
Save ravipatel2293/83cb07a702feb8e434826edf8ba12c81 to your computer and use it in GitHub Desktop.
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