diff --git a/Frontend/src/app/app.component.ts b/Frontend/src/app/app.component.ts index d45de93..f65d28c 100644 --- a/Frontend/src/app/app.component.ts +++ b/Frontend/src/app/app.component.ts @@ -1,6 +1,8 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import {NgcCookieConsentService, NgcInitializeEvent, NgcNoCookieLawEvent, NgcStatusChangeEvent} from 'ngx-cookieconsent'; import {Subscription} from 'rxjs'; +import {ApiService} from "./services/api.service"; + @Component({ selector: 'app-root', @@ -19,12 +21,18 @@ export class AppComponent implements OnInit, OnDestroy { private revokeChoiceSubscription: Subscription; private noCookieLawSubscription: Subscription; + isLoggedIn = false; + showUserBoard = false; + username?: string; + constructor( - private ccService: NgcCookieConsentService + private ccService: NgcCookieConsentService, + private api: ApiService ) { } ngOnInit(): void { + // subscribe to cookieconsent observables to react to main events this.popupOpenSubscription = this.ccService.popupOpen$.subscribe( () => { diff --git a/Frontend/src/app/app.module.ts b/Frontend/src/app/app.module.ts index 5da2756..153ae2c 100644 --- a/Frontend/src/app/app.module.ts +++ b/Frontend/src/app/app.module.ts @@ -39,6 +39,7 @@ import { GreetingInfoSliderComponent } from './components/greeting-info-slider/g import { KundenComponent } from './components/kunden/kunden.component'; import { AboutUsComponent } from './components/about-us/about-us.component'; import { ProfileComponent } from './components/profile/profile.component'; +import { ProfilePageComponent } from './pages/profile-page/profile-page.component'; // For cookie popup const cookieConfig: NgcCookieConsentConfig = { @@ -104,6 +105,7 @@ const cookieConfig: NgcCookieConsentConfig = { KundenComponent, AboutUsComponent, ProfileComponent, + ProfilePageComponent, ], imports: [ BrowserModule, diff --git a/Frontend/src/app/app.routing.ts b/Frontend/src/app/app.routing.ts index 58ddb59..2e13ded 100644 --- a/Frontend/src/app/app.routing.ts +++ b/Frontend/src/app/app.routing.ts @@ -12,6 +12,7 @@ import {PrivacyComponent} from './pages/privacy/privacy.component'; import {SigninComponent} from "./components/auth/signin/signin.component"; import {RegistrationComponent} from "./components/auth/registration/registration.component"; import {ProfileComponent} from "./components/profile/profile.component"; +import {ProfilePageComponent} from "./pages/profile-page/profile-page.component"; const routes: Routes = [ {path: '', component: LandingpageComponent, pathMatch: 'full'}, @@ -22,7 +23,7 @@ const routes: Routes = [ {path: 'signin', component: SigninComponent}, {path: 'registration', component: RegistrationComponent}, {path: "product-detail", component: ProductDetailPageComponent}, - {path: "profile", component: ProfileComponent}, + {path: "profile", component: ProfilePageComponent}, {path: '**', component: PageNotFoundPageComponent} ]; diff --git a/Frontend/src/app/components/auth/registration/registration.component.ts b/Frontend/src/app/components/auth/registration/registration.component.ts index ff8c904..a624666 100644 --- a/Frontend/src/app/components/auth/registration/registration.component.ts +++ b/Frontend/src/app/components/auth/registration/registration.component.ts @@ -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); + } + ); } } diff --git a/Frontend/src/app/components/auth/signin/signin.component.ts b/Frontend/src/app/components/auth/signin/signin.component.ts index dee46ed..8ca6646 100644 --- a/Frontend/src/app/components/auth/signin/signin.component.ts +++ b/Frontend/src/app/components/auth/signin/signin.component.ts @@ -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; 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 7def010..947b3f9 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 @@ -11,16 +11,16 @@
+ alarms + {{alarms}} +
+Produkt | +Preis | +
---|---|
+ {{productsMap[alarm.product_id]?.name}} + | ++ {{alarm.defined_price/100}} + | +
+ zurück +