This file contains hidden or 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 { CommonModule } from '@angular/common'; | |
| import { NgModule } from '@angular/core'; | |
| import { EffectsModule } from '@ngrx/effects'; | |
| import { StoreModule } from '@ngrx/store'; | |
| import { MyFeatureStoreModule } from './my-feature-store/'; | |
| import { MyOtherFeatureStoreModule } from './my-other-feature-store/'; | |
| @NgModule({ | |
| imports: [ | |
| CommonModule, |
This file contains hidden or 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 { MyFeatureStoreState } from './my-feature-store'; | |
| import { MyOtherFeatureStoreState } from './my-other-feature-store'; | |
| export interface State { | |
| myFeature: MyFeatureStoreState.State; | |
| myOtherFeature: MyOtherFeatureStoreState.State; | |
| } |
This file contains hidden or 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 * as MyFeatureStoreActions from './actions'; | |
| import * as MyFeatureStoreSelectors from './selectors'; | |
| import * as MyFeatureStoreState from './state'; | |
| export { | |
| MyFeatureStoreModule | |
| } from './my-feature-store.module'; | |
| export { | |
| MyFeatureStoreActions, |
This file contains hidden or 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 { CommonModule } from '@angular/common'; | |
| import { NgModule } from '@angular/core'; | |
| import { EffectsModule } from '@ngrx/effects'; | |
| import { StoreModule } from '@ngrx/store'; | |
| import { MyFeatureStoreEffects } from './effects'; | |
| import { featureReducer } from './reducer'; | |
| @NgModule({ | |
| imports: [ | |
| CommonModule, |
This file contains hidden or 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 { Actions, Effect, ofType } from '@ngrx/effects'; | |
| import { Action } from '@ngrx/store'; | |
| import { Observable, of as observableOf } from 'rxjs'; | |
| import { catchError, map, startWith, switchMap } from 'rxjs/operators'; | |
| import { DataService } from '../../services/data.service'; | |
| import * as featureActions from './actions'; | |
| @Injectable() | |
| export class MyFeatureStoreEffects { |
This file contains hidden or 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 { Actions, Effect, ofType } from '@ngrx/effects'; | |
| import { Action } from '@ngrx/store'; | |
| import { Observable, of as observableOf } from 'rxjs'; | |
| import { catchError, map, startWith, switchMap } from 'rxjs/operators'; | |
| import { DataService } from '../../services/data.service'; | |
| import * as featureActions from './actions'; | |
| @Injectable() | |
| export class MyFeatureStoreEffects { |
This file contains hidden or 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 { | |
| createFeatureSelector, | |
| createSelector, | |
| MemoizedSelector | |
| } from '@ngrx/store'; | |
| import { User } from '../../models'; | |
| import { State } from './state'; |
This file contains hidden or 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 { | |
| createFeatureSelector, | |
| createSelector, | |
| MemoizedSelector | |
| } from '@ngrx/store'; | |
| import { MyModel } from '../models'; | |
| import { featureAdapter, State } from './state'; |
This file contains hidden or 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 { Action } from '@ngrx/store'; | |
| import { User } from '../../models'; | |
| export enum ActionTypes { | |
| LOGIN_REQUEST = '[My Feature] Login Request', | |
| LOGIN_FAILURE = '[My Feature] Login Failure', | |
| LOGIN_SUCCESS = '[My Feature] Login Success' | |
| } | |
| export class LoginRequestAction implements Action { |
This file contains hidden or 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 { Actions, ActionTypes } from './actions'; | |
| import { initialState, State } from './state'; | |
| export function featureReducer(state = initialState, action: Actions): State { | |
| switch (action.type) { | |
| case ActionTypes.LOGIN_REQUEST: | |
| return { | |
| ...state, | |
| error: null, | |
| isLoading: true |