varminer-app-header 2.1.9 → 2.2.0
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/dist/index.d.ts +2 -2
- package/dist/index.esm.js +6 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -21
- package/dist/index.js.map +1 -1
- package/dist/utils/localStorage.d.ts +2 -2
- package/dist/utils/localStorage.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -376,32 +376,17 @@ const getAllDataFromStorage = () => {
|
|
|
376
376
|
}
|
|
377
377
|
};
|
|
378
378
|
/**
|
|
379
|
-
* Get profile picture URL from object store API using
|
|
379
|
+
* Get profile picture URL from object store API using user_id.
|
|
380
380
|
* @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
|
|
381
|
-
* @returns Profile picture URL or null if
|
|
381
|
+
* @returns Profile picture URL or null if user_id is not available
|
|
382
382
|
*/
|
|
383
383
|
const getProfilePictureUrl = (baseUrl = "http://objectstore.impact0mics.local:9012") => {
|
|
384
384
|
try {
|
|
385
385
|
const allData = getAllDataFromStorage();
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
tenantId = allData.decodedToken.tenant_id || allData.decodedToken.tenant || null;
|
|
391
|
-
userId = allData.decodedToken.user_id || null;
|
|
392
|
-
}
|
|
393
|
-
// If not found in decoded token, try auth data
|
|
394
|
-
if ((!tenantId || !userId) && allData.auth) {
|
|
395
|
-
tenantId = tenantId || allData.auth.tenant_id || allData.auth.tenant || null;
|
|
396
|
-
userId = userId || allData.auth.user_id || null;
|
|
397
|
-
}
|
|
398
|
-
// Construct URL if we have both tenant_id and user_id
|
|
399
|
-
if (tenantId && userId) {
|
|
400
|
-
// Remove trailing slash from baseUrl if present
|
|
401
|
-
const cleanBaseUrl = baseUrl.replace(/\/$/, '');
|
|
402
|
-
return `${cleanBaseUrl}/v1/objectStore/profilePicture/path/${tenantId}/${userId}`;
|
|
403
|
-
}
|
|
404
|
-
return null;
|
|
386
|
+
const userId = allData.decodedToken?.user_id ?? allData.auth?.user_id ?? getStoredUserDetails()?.userId ?? null;
|
|
387
|
+
if (userId == null)
|
|
388
|
+
return null;
|
|
389
|
+
return `${baseUrl.replace(/\/$/, "")}/v1/objectStore/profilePicture/path/${userId}`;
|
|
405
390
|
}
|
|
406
391
|
catch (err) {
|
|
407
392
|
console.error("Error getting profile picture URL:", err);
|