Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 6x 82x 26x 26x 26x 21x 21x 5x 5x | /**
* Utility function to format avatar URL consistently across the app
*/
export const formatAvatarUrl = (avatar: any): string | null => {
if (!avatar) return null;
const apiUrl = import.meta.env.VITE_API_URL;
const baseUrl = apiUrl.replace('/api', '');
if (typeof avatar === 'object' && 'url' in avatar) {
const url = avatar.url;
return url.startsWith('http') ? url : `${baseUrl}${url}`;
}
Eif (typeof avatar === 'string') {
return avatar.startsWith('http') ? avatar : `${baseUrl}${avatar}`;
}
return null;
};
|