Fix malformed url, when requesting data from the "getJobsOfUser" endpoint.

Previously, the url had its parameters starting with "&", instead of "?". The "offset"-param which was prepended with "?" was not the first param of the url!
This commit is contained in:
Lampros Smyrnaios 2023-02-20 19:06:43 +02:00
parent 94b99f8e51
commit 7dfbe3a51c
1 changed files with 4 additions and 5 deletions

View File

@ -30,11 +30,10 @@ export class MonitorService {
getJobsOfUser(params: URLParameter[]): Observable<JobsOfUser> { getJobsOfUser(params: URLParameter[]): Observable<JobsOfUser> {
let url = `${this.apiUrl}getJobsOfUser`; let url = `${this.apiUrl}getJobsOfUser`;
if ( params.length > 0 ) {
url += `?`
for (const param of params) { for (const param of params) {
if (param.key === 'offset') { url += `${param.key}=${param.value[0]}&`; // An ending "&" in the url does no cause any issues.
url += `?${param.key}=${param.value[0]}`;
} else {
url += `&${param.key}=${param.value[0]}`;
} }
} }
console.log(`knocking on: ${url}`); console.log(`knocking on: ${url}`);