diff --git a/Frontend/src/app/components/auth/registration/registration.component.html b/Frontend/src/app/components/auth/registration/registration.component.html index b752579..c18e6e0 100644 --- a/Frontend/src/app/components/auth/registration/registration.component.html +++ b/Frontend/src/app/components/auth/registration/registration.component.html @@ -9,27 +9,30 @@

Konto erstellen

-
+
- + +
+
Username is required
+
- +
- +
+ -
+ -->
-

Haben Sie bereits ein Konto?Sich anmelden

+ Sich anmelden
diff --git a/Frontend/src/app/components/auth/registration/registration.component.ts b/Frontend/src/app/components/auth/registration/registration.component.ts index 2c5f5a5..3f54551 100644 --- a/Frontend/src/app/components/auth/registration/registration.component.ts +++ b/Frontend/src/app/components/auth/registration/registration.component.ts @@ -1,4 +1,7 @@ import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import {ApiService} from "../../../services/api.service"; + @Component({ selector: 'app-registration', @@ -6,10 +9,30 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./registration.component.css'] }) export class RegistrationComponent implements OnInit { + form: any; + loading = false; + submitted = false; - constructor() { } + constructor( + private formBuilder: FormBuilder, + private api : ApiService + ) { } ngOnInit(): void { + this.form = this.formBuilder.group({ + username: ['', Validators.required], + email: ['', Validators.required], + password: ['', [ + Validators.required, + Validators.minLength(8)] + ], + }); } + get me() { return this.form.controls; } + + onSubmit() { + console.log(this.form.value); + this.api.registerUser(this.form.value.username, this.form.value.password, this.form.value.email).subscribe(res=>console.log(res)); + } } diff --git a/Frontend/src/app/components/auth/signin/signin.component.html b/Frontend/src/app/components/auth/signin/signin.component.html index 0a415c6..dcfb76a 100644 --- a/Frontend/src/app/components/auth/signin/signin.component.html +++ b/Frontend/src/app/components/auth/signin/signin.component.html @@ -9,13 +9,13 @@

Anmelden

-
+
- +
- +
@@ -23,7 +23,7 @@
-

Noch kein Konto?Konto erstellen

+ Konto erstellen
diff --git a/Frontend/src/app/components/auth/signin/signin.component.ts b/Frontend/src/app/components/auth/signin/signin.component.ts index e497f15..8bf594f 100644 --- a/Frontend/src/app/components/auth/signin/signin.component.ts +++ b/Frontend/src/app/components/auth/signin/signin.component.ts @@ -1,4 +1,6 @@ import { Component, OnInit } from '@angular/core'; +import {FormBuilder, Validators} from "@angular/forms"; +import {ApiService} from "../../../services/api.service"; @Component({ selector: 'app-signin', @@ -8,12 +10,22 @@ import { Component, OnInit } from '@angular/core'; export class SigninComponent implements OnInit { - constructor() { } + form: any; - ngOnInit(): void { - } + constructor( + private formBuilder: FormBuilder, + private api : ApiService + ) { } - onSubmit() { + ngOnInit(): void { + this.form = this.formBuilder.group({ + email: ['', Validators.required], + password: ['', Validators.required] + }); + } - } + onSubmit() { + console.log(this.form.value); + this.api.loginUser(this.form.value.username, this.form.value.password); + } } diff --git a/Frontend/src/app/components/hot-deals-widget/hot-deals-widget.component.html b/Frontend/src/app/components/hot-deals-widget/hot-deals-widget.component.html index 36ea156..a77fc6f 100644 --- a/Frontend/src/app/components/hot-deals-widget/hot-deals-widget.component.html +++ b/Frontend/src/app/components/hot-deals-widget/hot-deals-widget.component.html @@ -9,7 +9,7 @@
-
+
@@ -17,7 +17,7 @@
{{product.name}}
-
Amazon: 699.00$
+
Amazon: {{product.price}}$
Plantshub: 599,00$
diff --git a/Frontend/src/app/models/product.ts b/Frontend/src/app/models/product.ts index 8c51860..a73850e 100644 --- a/Frontend/src/app/models/product.ts +++ b/Frontend/src/app/models/product.ts @@ -11,4 +11,5 @@ export interface Product { manufacturer_id: number; selling_rank: string; category_id: number; + price: number; } diff --git a/Frontend/src/app/pages/product-detail-page/product-detail-page.component.html b/Frontend/src/app/pages/product-detail-page/product-detail-page.component.html index bf2d7cc..a75e4d4 100644 --- a/Frontend/src/app/pages/product-detail-page/product-detail-page.component.html +++ b/Frontend/src/app/pages/product-detail-page/product-detail-page.component.html @@ -1,7 +1,7 @@ -
+ diff --git a/Frontend/src/app/services/api.service.ts b/Frontend/src/app/services/api.service.ts index 8d06a81..20e9e27 100644 --- a/Frontend/src/app/services/api.service.ts +++ b/Frontend/src/app/services/api.service.ts @@ -11,6 +11,7 @@ import {ContactPerson} from '../models/contactperson'; import {Category} from '../models/category'; import {Manufacturer} from '../models/manufacturer'; import {CrawlingStatus} from '../models/crawlingstatus'; +import {log} from "util"; @Injectable({ providedIn: 'root'