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.d.ts
CHANGED
|
@@ -97,9 +97,9 @@ declare const setI18nLocaleToStorage: (locale: string) => void;
|
|
|
97
97
|
*/
|
|
98
98
|
declare const getAllDataFromStorage: () => any;
|
|
99
99
|
/**
|
|
100
|
-
* Get profile picture URL from object store API using
|
|
100
|
+
* Get profile picture URL from object store API using user_id.
|
|
101
101
|
* @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
|
|
102
|
-
* @returns Profile picture URL or null if
|
|
102
|
+
* @returns Profile picture URL or null if user_id is not available
|
|
103
103
|
*/
|
|
104
104
|
declare const getProfilePictureUrl: (baseUrl?: string) => string | null;
|
|
105
105
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -356,32 +356,17 @@ const getAllDataFromStorage = () => {
|
|
|
356
356
|
}
|
|
357
357
|
};
|
|
358
358
|
/**
|
|
359
|
-
* Get profile picture URL from object store API using
|
|
359
|
+
* Get profile picture URL from object store API using user_id.
|
|
360
360
|
* @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
|
|
361
|
-
* @returns Profile picture URL or null if
|
|
361
|
+
* @returns Profile picture URL or null if user_id is not available
|
|
362
362
|
*/
|
|
363
363
|
const getProfilePictureUrl = (baseUrl = "http://objectstore.impact0mics.local:9012") => {
|
|
364
364
|
try {
|
|
365
365
|
const allData = getAllDataFromStorage();
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
tenantId = allData.decodedToken.tenant_id || allData.decodedToken.tenant || null;
|
|
371
|
-
userId = allData.decodedToken.user_id || null;
|
|
372
|
-
}
|
|
373
|
-
// If not found in decoded token, try auth data
|
|
374
|
-
if ((!tenantId || !userId) && allData.auth) {
|
|
375
|
-
tenantId = tenantId || allData.auth.tenant_id || allData.auth.tenant || null;
|
|
376
|
-
userId = userId || allData.auth.user_id || null;
|
|
377
|
-
}
|
|
378
|
-
// Construct URL if we have both tenant_id and user_id
|
|
379
|
-
if (tenantId && userId) {
|
|
380
|
-
// Remove trailing slash from baseUrl if present
|
|
381
|
-
const cleanBaseUrl = baseUrl.replace(/\/$/, '');
|
|
382
|
-
return `${cleanBaseUrl}/v1/objectStore/profilePicture/path/${tenantId}/${userId}`;
|
|
383
|
-
}
|
|
384
|
-
return null;
|
|
366
|
+
const userId = allData.decodedToken?.user_id ?? allData.auth?.user_id ?? getStoredUserDetails()?.userId ?? null;
|
|
367
|
+
if (userId == null)
|
|
368
|
+
return null;
|
|
369
|
+
return `${baseUrl.replace(/\/$/, "")}/v1/objectStore/profilePicture/path/${userId}`;
|
|
385
370
|
}
|
|
386
371
|
catch (err) {
|
|
387
372
|
console.error("Error getting profile picture URL:", err);
|