logininfo.reducer.ts 696 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
import { ILoginInfo, ILoginInfoToken } from './logininfo.types';
import { INITIAL_STATE } from './logininfo.initial-state';
import { Seq } from 'immutable';

import {
  LOGININFO_SAVE
} from '../../constants';

export function loginInfoReducer(state: ILoginInfo = INITIAL_STATE, action): ILoginInfo {
  switch (action.type) {
    case LOGININFO_SAVE:
        let loginInfoTokens = Array<ILoginInfoToken>();
Open Source Developer's avatar
Open Source Developer committed
13
        loginInfoTokens.push(<ILoginInfoToken>{auth_token: action.payload.loginInfo.auth_token, auth_role: action.payload.loginInfo.auth_role, cu_name: action.payload.loginInfo.cu_name });
14
        return Seq(loginInfoTokens).map(n => n).toList();
15
16
    default:
        return state;
17
18
  }
};