54 lines
1.3 KiB
TypeScript
Raw Normal View History

2019-09-18 15:02:21 +09:00
import { Component, OnInit } from '@angular/core';
2019-09-26 14:38:21 +09:00
import { Store, select } from '@ngrx/store';
2019-09-18 15:02:21 +09:00
2019-09-26 14:38:21 +09:00
import { Company } from '@ucap-webmessenger/api-external';
2019-09-18 15:02:21 +09:00
2019-09-26 14:38:21 +09:00
import * as AppStore from '@app/store';
import * as AuthenticationStore from '@app/store/account/authentication';
import * as CompanyStore from '@app/store/setting/company';
import { Observable } from 'rxjs';
2019-09-18 15:02:21 +09:00
@Component({
selector: 'app-page-account-login',
templateUrl: './login.page.component.html',
styleUrls: ['./login.page.component.scss']
})
export class LoginPageComponent implements OnInit {
2019-09-26 14:38:21 +09:00
companyList$: Observable<Company[]>;
2019-09-18 15:02:21 +09:00
2019-09-26 14:38:21 +09:00
constructor(private store: Store<any>) {}
2019-09-18 15:02:21 +09:00
ngOnInit(): void {
2019-09-26 14:38:21 +09:00
this.store.dispatch(
CompanyStore.companyList({
companyGroupCode: 'LG'
})
);
this.companyList$ = this.store.pipe(
select(AppStore.SettingSelector.CompanySelector.companyList)
);
2019-09-18 15:02:21 +09:00
}
onLogin(value: {
companyCode: string;
loginId: string;
loginPw: string;
rememberMe: boolean;
notValid: () => void;
}) {
this.store.dispatch(
2019-09-24 09:23:30 +09:00
AuthenticationStore.webLogin({
2019-09-18 15:02:21 +09:00
loginInfo: {
companyCode: value.companyCode,
2019-09-27 12:53:21 +09:00
companyGroupType: 'C',
2019-09-18 15:02:21 +09:00
loginId: value.loginId,
loginPw: value.loginPw
},
rememberMe: value.rememberMe
})
);
}
}