21 lines
408 B
TypeScript
21 lines
408 B
TypeScript
|
import { createReducer, on } from '@ngrx/store';
|
||
|
|
||
|
import { initialState } from './state';
|
||
|
import { loginSuccess, logoutSuccess } from './actions';
|
||
|
|
||
|
export const reducer = createReducer(
|
||
|
initialState,
|
||
|
on(loginSuccess, (state, action) => {
|
||
|
return {
|
||
|
...state,
|
||
|
loginRes: action.loginRes
|
||
|
};
|
||
|
}),
|
||
|
|
||
|
on(logoutSuccess, (state, action) => {
|
||
|
return {
|
||
|
...initialState
|
||
|
};
|
||
|
})
|
||
|
);
|