Created
May 25, 2020 04:33
-
-
Save Tecayehuatl/66b5b150531f5247acdfa00b53db844e 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 { createReducer, on, Action } from '@ngrx/store'; | |
import { initialAppState, IApp } from '../app.interface'; | |
import { login, loginSuccess, loginFail } from '../actions/app.actions'; | |
export const userFeatureKey = 'AppState'; | |
export const reducer = createReducer( | |
initialAppState as IApp, | |
on(login, (state) => ({ | |
...state, | |
})), | |
on(loginSuccess, (state) => ({ | |
...state, | |
authenticationMessage: null, | |
})), | |
on(loginFail, (state, { message }) => ({ | |
...state, | |
authenticationMessage: message, | |
})) | |
); | |
export function AppReducer(state: IApp, action: Action): IApp { | |
return reducer(state as IApp, action as Action); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment