wip: profile component

This commit is contained in:
2021-06-17 09:55:40 +02:00
parent be534551ba
commit 969ac6feaf
13 changed files with 113 additions and 19 deletions
@@ -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;