mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
98344: Implemented the Select reviewers advanced step
This commit is contained in:
@@ -252,8 +252,8 @@ export class RequestService {
|
||||
/**
|
||||
* Convert request Payload to a URL-encoded string
|
||||
*
|
||||
* e.g. uriEncodeBody({param: value, param1: value1})
|
||||
* returns: param=value¶m1=value1
|
||||
* e.g. uriEncodeBody({param: value, param1: value1, param2: [value3, value4]})
|
||||
* returns: param=value¶m1=value1¶m2=value3¶m2=value4
|
||||
*
|
||||
* @param body
|
||||
* The request Payload to convert
|
||||
@@ -264,11 +264,19 @@ export class RequestService {
|
||||
let queryParams = '';
|
||||
if (isNotEmpty(body) && typeof body === 'object') {
|
||||
Object.keys(body)
|
||||
.forEach((param) => {
|
||||
.forEach((param: string) => {
|
||||
const encodedParam = encodeURIComponent(param);
|
||||
const encodedBody = encodeURIComponent(body[param]);
|
||||
const paramValue = `${encodedParam}=${encodedBody}`;
|
||||
queryParams = isEmpty(queryParams) ? queryParams.concat(paramValue) : queryParams.concat('&', paramValue);
|
||||
if (Array.isArray(body[param])) {
|
||||
for (const element of body[param]) {
|
||||
const encodedBody = encodeURIComponent(element);
|
||||
const paramValue = `${encodedParam}=${encodedBody}`;
|
||||
queryParams = isEmpty(queryParams) ? queryParams.concat(paramValue) : queryParams.concat('&', paramValue);
|
||||
}
|
||||
} else {
|
||||
const encodedBody = encodeURIComponent(body[param]);
|
||||
const paramValue = `${encodedParam}=${encodedBody}`;
|
||||
queryParams = isEmpty(queryParams) ? queryParams.concat(paramValue) : queryParams.concat('&', paramValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
return queryParams;
|
||||
|
Reference in New Issue
Block a user