Commit e0ab30aa authored by David Burke's avatar David Burke

Mobile

parent f8ad0457
Pipeline #37851947 passed with stages
in 5 minutes and 48 seconds
...@@ -34,6 +34,8 @@ import { ...@@ -34,6 +34,8 @@ import {
ChangePasswordComponent, ChangePasswordComponent,
ChangePasswordContainer ChangePasswordContainer
} from "./change-password"; } from "./change-password";
import { TNSLoginEffects } from "./login/tns-login-effects";
import { MobileMenuModule } from "../mobile-menu";
export const COMPONENTS = [ export const COMPONENTS = [
LoginContainer, LoginContainer,
...@@ -60,9 +62,11 @@ export const SERVICES = [BackupCodePdfService, UserService, ConfirmEmailGuard]; ...@@ -60,9 +62,11 @@ export const SERVICES = [BackupCodePdfService, UserService, ConfirmEmailGuard];
NgrxFormsModule, NgrxFormsModule,
SharedModule, SharedModule,
ProgressIndicatorModule, ProgressIndicatorModule,
MobileMenuModule,
StoreModule.forFeature("account", reducers), StoreModule.forFeature("account", reducers),
EffectsModule.forFeature([ EffectsModule.forFeature([
LoginEffects, LoginEffects,
TNSLoginEffects,
LoginFormEffects, LoginFormEffects,
RegisterEffects, RegisterEffects,
ConfirmEmailEffects, ConfirmEmailEffects,
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
returnKeyType="next" returnKeyType="next"
[isFormSubmitted]="form.isSubmitted" [isFormSubmitted]="form.isSubmitted"
[ngrxFormControl]="form.controls.email" [ngrxFormControl]="form.controls.email"
(returnPress)="focusPassword()"
></app-text-field> ></app-text-field>
<Label <Label
......
import {
Component,
EventEmitter,
Input,
Output,
ViewChild,
ElementRef
} from "@angular/core";
import { FormGroupState, MarkAsSubmittedAction } from "ngrx-forms";
import { ActionsSubject } from "@ngrx/store";
import { ILoginForm } from "./interfaces";
@Component({
selector: "login-component",
moduleId: module.id,
templateUrl: "./login.component.html",
styleUrls: ["../shared/auth.styles.css"]
})
export class LoginComponent {
@Input() form: FormGroupState<ILoginForm>;
@Input() errorMessage: string;
@Input() hasLoginStarted: boolean;
@Input() hasLoginFinished: boolean;
@Output() login = new EventEmitter<ILoginForm>();
@Output() goToRegister = new EventEmitter();
@ViewChild("password") password: ElementRef;
constructor(private actionsSubject: ActionsSubject) {}
onSubmit() {
if (this.form.isValid) {
this.login.emit();
} else if (this.form.isUnsubmitted) {
this.actionsSubject.next(new MarkAsSubmittedAction(this.form.id));
}
}
}
import { Injectable } from "@angular/core";
import { Effect, Actions, ofType } from "@ngrx/effects";
import { AccountActionTypes } from "../account.actions";
import { RouterExtensions } from "nativescript-angular/router";
import { tap } from "rxjs/operators";
@Injectable()
export class TNSLoginEffects {
@Effect({ dispatch: false })
loginSuccess$ = this.actions$.pipe(
ofType(AccountActionTypes.LOGIN_SUCCESS),
tap(() => {
this.router.navigate(["/list"], { clearHistory: true });
})
);
constructor(private actions$: Actions, private router: RouterExtensions) {}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment