Last active
December 28, 2021 22:38
-
-
Save NyaGarcia/f39a4646ff383c4e7519ada41d04224c to your computer and use it in GitHub Desktop.
Implementing the register logic in the register page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { AuthService } from 'src/app/core/services/auth.service'; | |
import { LoginData } from 'src/app/core/interfaces/login-data.interface'; | |
import { Router } from '@angular/router'; | |
@Component({ | |
selector: 'app-register-page', | |
templateUrl: './register-page.component.html', | |
styleUrls: ['./register-page.component.css'], | |
}) | |
export class RegisterPageComponent implements OnInit { | |
constructor( | |
private readonly authService: AuthService, | |
private readonly router: Router | |
) {} | |
ngOnInit(): void {} | |
register(data: LoginData) { | |
this.authService | |
.register(data) | |
.then(() => this.router.navigate(['/login'])) | |
.catch((e) => console.log(e.message)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment