2020-03-27 17:39:01 +09:00
|
|
|
import { createReducer, on } from '@ngrx/store';
|
|
|
|
|
|
|
|
import { initialState } from './state';
|
2020-07-11 19:57:44 +09:00
|
|
|
import { loginSuccess, logoutSuccess } from './actions';
|
2020-03-27 17:39:01 +09:00
|
|
|
|
|
|
|
export const reducer = createReducer(
|
|
|
|
initialState,
|
|
|
|
on(loginSuccess, (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
2020-08-10 14:05:57 +09:00
|
|
|
loginInfo: action.loginInfo
|
2020-03-27 17:39:01 +09:00
|
|
|
};
|
|
|
|
}),
|
|
|
|
|
|
|
|
on(logoutSuccess, (state, action) => {
|
|
|
|
return {
|
|
|
|
...initialState
|
|
|
|
};
|
|
|
|
})
|
|
|
|
);
|