logininfo.actions.ts 865 Bytes
Newer Older
1
import { LOGININFO_SAVE, LOGININFO_RECEIVED } from '../constants';
Open Source Developer's avatar
Open Source Developer committed
2
import { LOGININFO_INIT } from '../constants';
3
4
5
6
7
8
9
10
11
12
13
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
import { HelperDataService } from '../services/helper-data-service';

@Injectable()
export class LoginInfoActions {
  constructor(
    private _ngRedux: NgRedux<IAppState>,
    private _hds: HelperDataService) {}

14
 
Open Source Developer's avatar
Open Source Developer committed
15
 getloginInfo = (loginInfo) => {
16
 return this._hds.getCurrentUser(loginInfo.auth_token, loginInfo.auth_role).then (loginInfos => {
17
18
19
      return this._ngRedux.dispatch({
        type: LOGININFO_SAVE,
        payload: {
20
          loginInfos
21
22
        }
      });
23
  });
Open Source Developer's avatar
Open Source Developer committed
24
}
25

26
27
28
29
30
31
32
33
  initLoginInfo = () => {
      return this._ngRedux.dispatch({
          type: LOGININFO_INIT,
          payload: {
          }
      });
  };

34
35

}