mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-11-22 06:13:57 +00:00
wip: profile component
This commit is contained in:
parent
b748b9492a
commit
9821c004ec
|
@ -36,8 +36,8 @@ export class RegistrationComponent implements OnInit {
|
|||
onSubmit() {
|
||||
this.api.registerUser(this.form.value.username, this.form.value.password, this.form.value.email).subscribe(
|
||||
res=> {
|
||||
this.router.navigate(['']);
|
||||
this.api.saveSessionInfoToLocalStorage(res);
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ export class ProfileComponent implements OnInit {
|
|||
currentUser: any;
|
||||
obj:any;
|
||||
alarms: any [];
|
||||
productsMap: any;
|
||||
productsMap: any = {};
|
||||
|
||||
constructor(private api: ApiService ) { }
|
||||
|
||||
|
@ -37,7 +37,7 @@ export class ProfileComponent implements OnInit {
|
|||
}
|
||||
|
||||
getProductsByIds(): void {
|
||||
let productIds: number [];
|
||||
let productIds: number [] = [];
|
||||
this.alarms.forEach(
|
||||
alarm => {productIds.push(alarm.product_id)}
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="container">
|
||||
<a class="navbar-brand" routerLink=""> Betterzon</a>
|
||||
<form class="form-inline my-2 my-lg-0">
|
||||
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" (keyup.enter)="getSearchedProducts()">
|
||||
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" (keyup.enter)="getSearchedProducts()" [(ngModel)]="searchQuery">
|
||||
</form>
|
||||
<button class="navbar-toggler text-uppercase font-weight-bold bg-primary text-white rounded" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
|
||||
Menu
|
||||
|
|
|
@ -12,18 +12,21 @@ export class TopBarComponent implements OnInit {
|
|||
|
||||
sidenav: any;
|
||||
isLoggedIn: boolean;
|
||||
@Input() searchQuery: string;
|
||||
searchQuery: string;
|
||||
|
||||
constructor(
|
||||
private api: ApiService,
|
||||
private router: Router
|
||||
) { }
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.api.getUserInfo().subscribe(data=>{console.log(data)});
|
||||
this.api.getUserInfo().subscribe(data => {
|
||||
console.log(data)
|
||||
});
|
||||
|
||||
if ( this.api.getSessionInfoFromLocalStorage().session_id != "") {
|
||||
if (this.api.getSessionInfoFromLocalStorage().session_id != "") {
|
||||
this.isLoggedIn = true;
|
||||
}
|
||||
}
|
||||
|
@ -35,10 +38,12 @@ export class TopBarComponent implements OnInit {
|
|||
}
|
||||
|
||||
getSearchedProducts(): void {
|
||||
this.api.getProductsByQuery(this.searchQuery).subscribe(
|
||||
data => {
|
||||
this.router.navigate([('/registration')]);
|
||||
console.log(this.searchQuery);
|
||||
this.redirectTo('/search', {queryParams: {q: this.searchQuery}});
|
||||
}
|
||||
);
|
||||
|
||||
redirectTo(uri: string, queryParams: object): void {
|
||||
this.router.navigateByUrl('/', {skipLocationChange: true}).then(() =>
|
||||
this.router.navigate([uri], queryParams));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
<div id="mainComponents">
|
||||
<app-product-list numberOfProducts="20" [showProductPicture]="true" searchQuery="{{searchTerm}}"
|
||||
type="search"></app-product-list>
|
||||
</div>
|
||||
|
||||
<app-footer></app-footer>
|
||||
<app-bottom-bar></app-bottom-bar>
|
||||
|
|
Loading…
Reference in New Issue
Block a user