mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-19 16:03:02 +00:00
another intermediate commit
This commit is contained in:
@@ -39,7 +39,7 @@ export class CollectionsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hasSucceeded() {
|
hasSucceeded() {
|
||||||
this.item.owner.map((rd: RemoteData<Collection>) => rd.hasSucceeded)
|
return this.item.owner.map((rd: RemoteData<Collection>) => rd.hasSucceeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ export abstract class BaseResponseParsingService {
|
|||||||
} else if (Array.isArray(data)) {
|
} else if (Array.isArray(data)) {
|
||||||
return this.processArray(data, requestHref);
|
return this.processArray(data, requestHref);
|
||||||
} else if (isObjectLevel(data)) {
|
} else if (isObjectLevel(data)) {
|
||||||
const object = this.deserialize(data, requestHref);
|
let object = this.deserialize(data, requestHref);
|
||||||
this.cache(object, requestHref);
|
this.cache(object, requestHref);
|
||||||
if (isNotEmpty(data._embedded)) {
|
if (isNotEmpty(data._embedded)) {
|
||||||
const list = {};
|
const list = {};
|
||||||
@@ -42,12 +42,10 @@ export abstract class BaseResponseParsingService {
|
|||||||
.keys(data._embedded)
|
.keys(data._embedded)
|
||||||
.filter((property) => data._embedded.hasOwnProperty(property))
|
.filter((property) => data._embedded.hasOwnProperty(property))
|
||||||
.forEach((property) => {
|
.forEach((property) => {
|
||||||
console.log(data._embedded[property]);
|
|
||||||
const parsedObj = this.process<ObjectDomain, ObjectType>(data._embedded[property], requestHref);
|
const parsedObj = this.process<ObjectDomain, ObjectType>(data._embedded[property], requestHref);
|
||||||
list[property] = parsedObj;
|
list[property] = parsedObj;
|
||||||
});
|
});
|
||||||
console.log(list);
|
object = Object.assign({}, object, list);
|
||||||
Object.assign(object, list);
|
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@@ -66,7 +64,12 @@ export abstract class BaseResponseParsingService {
|
|||||||
|
|
||||||
protected processPaginatedList<ObjectDomain, ObjectType>(data: any, requestHref: string): PaginatedList<ObjectDomain> {
|
protected processPaginatedList<ObjectDomain, ObjectType>(data: any, requestHref: string): PaginatedList<ObjectDomain> {
|
||||||
const pageInfo: PageInfo = this.processPageInfo(data);
|
const pageInfo: PageInfo = this.processPageInfo(data);
|
||||||
const list = this.flattenSingleKeyObject(data._embedded);
|
let list = data._embedded;
|
||||||
|
|
||||||
|
// Workaround for inconsistancy in rest response - sometimes page embeds are wrapped in another object
|
||||||
|
if (!Array.isArray(list)) {
|
||||||
|
list = this.flattenSingleKeyObject(list);
|
||||||
|
}
|
||||||
const page: ObjectDomain[] = this.processArray(list, requestHref);
|
const page: ObjectDomain[] = this.processArray(list, requestHref);
|
||||||
return new PaginatedList<ObjectDomain>(pageInfo, page);
|
return new PaginatedList<ObjectDomain>(pageInfo, page);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user