Skip to content
Snippets Groups Projects
Verified Commit bb8372fa authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #8956 fix sevral call rest route

parent d59fa2b3
No related branches found
No related tags found
No related merge requests found
import { ChangeDetectorRef, Component, OnInit, ViewChild, Inject, EventEmitter } from '@angular/core'; import { ChangeDetectorRef, Component, OnInit, ViewChild, Inject, EventEmitter, AfterViewInit } from '@angular/core';
import { MediaMatcher } from '@angular/cdk/layout'; import { MediaMatcher } from '@angular/cdk/layout';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { LANG } from '../translate.component'; import { LANG } from '../translate.component';
...@@ -113,6 +113,10 @@ export class BasketListComponent implements OnInit { ...@@ -113,6 +113,10 @@ export class BasketListComponent implements OnInit {
this.mobileQuery = media.matchMedia('(max-width: 768px)'); this.mobileQuery = media.matchMedia('(max-width: 768px)');
this._mobileQueryListener = () => changeDetectorRef.detectChanges(); this._mobileQueryListener = () => changeDetectorRef.detectChanges();
this.mobileQuery.addListener(this._mobileQueryListener); this.mobileQuery.addListener(this._mobileQueryListener);
route.params.forEach(params => {
this.basketUrl = '../../rest/resourcesList/users/' + params['userSerialId'] + '/groups/' + params['groupSerialId'] + '/baskets/' + params['basketId'];
});
} }
ngOnInit(): void { ngOnInit(): void {
...@@ -131,27 +135,26 @@ export class BasketListComponent implements OnInit { ...@@ -131,27 +135,26 @@ export class BasketListComponent implements OnInit {
}); });
this.isLoadingResults = false; this.isLoadingResults = false;
this.initResultList();
this.route.params.subscribe(params => { this.route.params.subscribe(params => {
this.basketUrl = this.coreUrl + 'rest/resourcesList/users/' + params['userSerialId'] + '/groups/' + params['groupSerialId'] + '/baskets/' + params['basketId'];
this.http.get(this.basketUrl)
.subscribe((data: any) => {
this.currentBasketInfo = {
ownerId: params['userSerialId'],
groupId: params['groupSerialId'],
basketId: params['basketId']
};
this.headerService.headerMessage = data.basketLabel;
this.filtersListService.filterMode = false;
window['MainHeaderComponent'].setSnav(this.sidenavLeft);
window['MainHeaderComponent'].setSnavRight(this.sidenavRight);
this.listProperties = this.filtersListService.initListsProperties('bbain', params['groupSerialId'], params['basketId']); this.currentBasketInfo = {
this.initResultList(); ownerId: params['userSerialId'],
groupId: params['groupSerialId'],
basketId: params['basketId']
};
//this.headerService.headerMessage = data.basketLabel;
this.filtersListService.filterMode = false;
window['MainHeaderComponent'].setSnav(this.sidenavLeft);
window['MainHeaderComponent'].setSnavRight(this.sidenavRight);
this.listProperties = this.filtersListService.initListsProperties('bbain', params['groupSerialId'], params['basketId']);
this.refreshDao();
}, () => {
location.href = "index.php";
});
}); });
} }
...@@ -174,7 +177,7 @@ export class BasketListComponent implements OnInit { ...@@ -174,7 +177,7 @@ export class BasketListComponent implements OnInit {
// Flip flag to show that loading has finished. // Flip flag to show that loading has finished.
this.isLoadingResults = false; this.isLoadingResults = false;
this.resultsLength = data.count; this.resultsLength = data.count;
this.headerService.headerMessage = data.basketLabel;
return data.resources; return data.resources;
}), }),
catchError(() => { catchError(() => {
...@@ -233,6 +236,7 @@ export class BasketListComponent implements OnInit { ...@@ -233,6 +236,7 @@ export class BasketListComponent implements OnInit {
export interface BasketList { export interface BasketList {
resources: any[]; resources: any[];
count: number; count: number;
basketLabel: string
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment