member_webapp/@overflow/member/container/member-signin-container.component.ts

34 lines
1.0 KiB
TypeScript
Raw Normal View History

2018-05-28 11:16:00 +00:00
import { Component, OnInit, Input } from '@angular/core';
2018-04-06 06:59:49 +00:00
import { ActivatedRoute, Router } from '@angular/router';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Store, select } from '@ngrx/store';
2018-05-28 11:16:00 +00:00
import { Observable } from 'rxjs';
2018-04-06 06:59:49 +00:00
2018-05-28 11:16:00 +00:00
import { MemberSigninContainerSelector } from '../store';
import * as MemberEntityStore from '../store/entity/member';
2018-04-06 06:59:49 +00:00
@Component({
2018-05-28 05:41:56 +00:00
selector: 'of-member-signin-container',
templateUrl: './member-signin-container.component.html',
2018-04-06 06:59:49 +00:00
})
2018-05-28 05:41:56 +00:00
export class MemberSigninContainerComponent implements OnInit {
2018-05-28 11:16:00 +00:00
@Input() returnURL: string;
pending$: Observable<boolean>;
error$: Observable<any>;
2018-04-06 06:59:49 +00:00
constructor(
2018-05-28 11:16:00 +00:00
private store: Store<any>,
2018-04-06 06:59:49 +00:00
) {
}
ngOnInit() {
2018-05-28 11:16:00 +00:00
this.pending$ = this.store.pipe(select(MemberSigninContainerSelector.selectPending));
this.error$ = this.store.pipe(select(MemberSigninContainerSelector.selectError));
2018-04-06 06:59:49 +00:00
}
2018-05-28 11:16:00 +00:00
onSignin(info: {email: string, password: string}) {
this.store.dispatch(new MemberEntityStore.Signin({...info, returnURL: this.returnURL}));
2018-04-06 06:59:49 +00:00
}
}