mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2026-09-22 21:03:45 +00:00
wip: profile component
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import {ApiService} from "../../../services/api.service";
|
||||
import {Router} from "@angular/router";
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -15,7 +16,8 @@ export class RegistrationComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private api : ApiService
|
||||
private api : ApiService,
|
||||
private router: Router
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -32,6 +34,11 @@ export class RegistrationComponent implements OnInit {
|
||||
get me() { return this.form.controls; }
|
||||
|
||||
onSubmit() {
|
||||
this.api.registerUser(this.form.value.username, this.form.value.password, this.form.value.email).subscribe(res=>console.log(res));
|
||||
this.api.registerUser(this.form.value.username, this.form.value.password, this.form.value.email).subscribe(
|
||||
res=> {
|
||||
this.router.navigate(['']);
|
||||
this.api.saveSessionInfoToLocalStorage(res);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ export class SigninComponent implements OnInit {
|
||||
.subscribe(
|
||||
data => {
|
||||
this.isSuccessful = true;
|
||||
this.isSignUpFailed = false;
|
||||
this.router.navigate(['']);
|
||||
this.api.saveSessionInfoToLocalStorage(data);
|
||||
},
|
||||
err => {
|
||||
this.errorMessage = err.error.message;
|
||||
|
||||
Reference in New Issue
Block a user