oip-common 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/fesm2022/oip-common.mjs
CHANGED
|
@@ -1570,23 +1570,31 @@ class UserService {
|
|
|
1570
1570
|
*/
|
|
1571
1571
|
get shortLabel() {
|
|
1572
1572
|
const data = this.securityService.getCurrentUser();
|
|
1573
|
-
|
|
1573
|
+
const givenNameInitial = data?.given_name?.trim()?.[0];
|
|
1574
|
+
const familyNameInitial = data?.family_name?.trim()?.[0];
|
|
1575
|
+
return `${givenNameInitial ?? ''}${familyNameInitial ?? ''}`.toUpperCase();
|
|
1574
1576
|
}
|
|
1575
1577
|
get userName() {
|
|
1576
1578
|
const data = this.securityService.getCurrentUser();
|
|
1577
|
-
return
|
|
1579
|
+
return [data?.given_name, data?.family_name].filter(Boolean).join(' ');
|
|
1578
1580
|
}
|
|
1579
1581
|
/**
|
|
1580
1582
|
* Initiates an HTTP request to fetch the user's photo based on their email,
|
|
1581
1583
|
* and updates the `photo` and `photoLoaded` properties accordingly.
|
|
1582
1584
|
*/
|
|
1583
1585
|
getUserPhoto() {
|
|
1584
|
-
const
|
|
1586
|
+
const email = this.securityService.getCurrentUser()?.email;
|
|
1587
|
+
if (!email) {
|
|
1588
|
+
this.photoLoaded = true;
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1591
|
+
const url = this.baseDataService.buildUrl(`api/user-profile/get-user-photo?email=${email}`);
|
|
1585
1592
|
this.baseDataService.getBlob(url).then((data) => {
|
|
1586
1593
|
this.createImageFromBlob(data);
|
|
1587
1594
|
this.photoLoaded = true;
|
|
1588
1595
|
}, (error) => {
|
|
1589
1596
|
console.log(error);
|
|
1597
|
+
this.photoLoaded = false;
|
|
1590
1598
|
});
|
|
1591
1599
|
}
|
|
1592
1600
|
/**
|