mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 23:13:04 +00:00
59415: Prevent empty pages returning error, initialize empty array instead
This commit is contained in:
@@ -27,7 +27,13 @@ export class DSOResponseParsingService extends BaseResponseParsingService implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
|
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
|
||||||
const processRequestDTO = this.process<NormalizedObject,ResourceType>(data.payload, request.href);
|
let processRequestDTO;
|
||||||
|
// Prevent empty pages returning an error, initialize empty array instead.
|
||||||
|
if (hasValue(data.payload) && hasValue(data.payload.page) && data.payload.page.totalElements === 0) {
|
||||||
|
processRequestDTO = { page: [] };
|
||||||
|
} else {
|
||||||
|
processRequestDTO = this.process<NormalizedObject, ResourceType>(data.payload, request.href);
|
||||||
|
}
|
||||||
let objectList = processRequestDTO;
|
let objectList = processRequestDTO;
|
||||||
if (hasNoValue(processRequestDTO)) {
|
if (hasNoValue(processRequestDTO)) {
|
||||||
return new DSOSuccessResponse([], data.statusCode, undefined)
|
return new DSOSuccessResponse([], data.statusCode, undefined)
|
||||||
|
Reference in New Issue
Block a user