new initialization process, keycloak update 24.0.4
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { KeycloakUser, ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { KeycloakService } from '../../../services/keycloak.service';
|
||||
import { ListingsService } from '../../../services/listings.service';
|
||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||
import { UserService } from '../../../services/user.service';
|
||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||
import { map2User } from '../../../utils/utils';
|
||||
import { MenuAccountComponent } from '../../menu-account/menu-account.component';
|
||||
|
||||
@Component({
|
||||
@@ -17,11 +18,10 @@ export class FavoritesComponent {
|
||||
user: KeycloakUser;
|
||||
listings: Array<ListingType> = []; //= dataListings as unknown as Array<BusinessListing>;
|
||||
favorites: Array<ListingType>;
|
||||
constructor(public userService: UserService, private listingsService: ListingsService, public selectOptions: SelectOptionsService) {
|
||||
this.user = this.userService.getKeycloakUser();
|
||||
}
|
||||
constructor(public keycloakService: KeycloakService, private listingsService: ListingsService, public selectOptions: SelectOptionsService) {}
|
||||
async ngOnInit() {
|
||||
// this.listings=await lastValueFrom(this.listingsService.getAllListings());
|
||||
const token = await this.keycloakService.getToken();
|
||||
this.user = map2User(token);
|
||||
this.favorites = this.listings.filter(l => l.favoritesForUser?.includes(this.user.id));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user