mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
65528: last coll/subcom undefined fix (wait for remoteData.succeeded)
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable, of} from 'rxjs';
|
||||
import {Observable} from 'rxjs';
|
||||
import {CommunityDataService} from '../core/data/community-data.service';
|
||||
import {PaginationComponentOptions} from '../shared/pagination/pagination-component-options.model';
|
||||
import {SortDirection, SortOptions} from '../core/cache/models/sort-options.model';
|
||||
import {take} from 'rxjs/operators';
|
||||
import {Community} from '../core/shared/community.model';
|
||||
import {RemoteData} from '../core/data/remote-data';
|
||||
import {PaginatedList} from '../core/data/paginated-list';
|
||||
|
||||
@Injectable()
|
||||
export class CommunityListService {
|
||||
@@ -20,22 +21,14 @@ export class CommunityListService {
|
||||
this.config.pageSize = 100;
|
||||
this.config.currentPage = 1;
|
||||
this.sortConfig = new SortOptions('dc.title', SortDirection.ASC);
|
||||
this.initTopCommunityList()
|
||||
}
|
||||
|
||||
private initTopCommunityList(): void {
|
||||
this.cds.findTop({
|
||||
public getCommunityList(): Observable<RemoteData<PaginatedList<Community>>> {
|
||||
return this.cds.findTop({
|
||||
currentPage: this.config.currentPage,
|
||||
elementsPerPage: this.config.pageSize,
|
||||
sort: { field: this.sortConfig.field, direction: this.sortConfig.direction }
|
||||
}).pipe(take(1)).subscribe((results) => {
|
||||
this.communities = results.payload.page;
|
||||
console.log('ping', this.communities);
|
||||
});
|
||||
}
|
||||
|
||||
public getCommunityList(): Observable<Community[]> {
|
||||
return of(this.communities);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user