From 7add36ddc8d7917ecb7d4891001aa1fca43908ca Mon Sep 17 00:00:00 2001 From: Eugen Neuber <eugen.neuber@tugraz.at> Date: Wed, 25 Sep 2019 14:27:28 +0200 Subject: [PATCH] Fix api calls with empty person identifier --- packages/person-profile/src/person-profile.js | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/person-profile/src/person-profile.js b/packages/person-profile/src/person-profile.js index 4b8ff46e..434d3dd3 100644 --- a/packages/person-profile/src/person-profile.js +++ b/packages/person-profile/src/person-profile.js @@ -49,19 +49,21 @@ class PersonProfile extends VPULitElement { }, {}, that.lang); break; case 'value': - const apiUrl = this.entryPointUrl + '/people/' + this.value; + if (this.value !== '') { + const apiUrl = this.entryPointUrl + '/people/' + this.value; - // load person - fetch(apiUrl, { - headers: { - 'Content-Type': 'application/ld+json', - 'Authorization': 'Bearer ' + window.VPUAuthToken, - }, - }) - .then(response => response.json()) - .then((person) => { - this.person = person; - }); + // load person + fetch(apiUrl, { + headers: { + 'Content-Type': 'application/ld+json', + 'Authorization': 'Bearer ' + window.VPUAuthToken, + }, + }) + .then(response => response.json()) + .then((person) => { + this.person = person; + }); + } break; default: } -- GitLab