File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 55 import { userStore } from ' $lib/helpers/store' ;
66 import { PUBLIC_SERVICE_URL } from ' $env/static/public' ;
77 import { _ } from ' svelte-i18n' ;
8+ import { buildUrl } from ' $lib/helpers/utils/common' ;
89
910 /** @type {any} */
1011 export let user;
3132 >
3233 <img
3334 class =" rounded-circle header-profile-user"
34- src ={` ${PUBLIC_SERVICE_URL }${ user ?.avatar }?access_token=${$userStore ?.token } ` }
35+ src ={` ${buildUrl ( PUBLIC_SERVICE_URL , user ?.avatar ) }?access_token=${$userStore ?.token } ` }
3536 alt =" "
3637 on:error ={e => handleAvatarLoad (e )}
3738 />
Original file line number Diff line number Diff line change 11export function range ( size = 3 , startAt = 0 ) {
22 return [ ...Array ( size ) . keys ( ) ] . map ( ( i ) => i + startAt ) ;
3- } ;
3+ } ;
4+
5+ /**
6+ * @param {string } baseUrl
7+ * @param {string } relativePath
8+ */
9+ export function buildUrl ( baseUrl , relativePath ) {
10+ return new URL ( relativePath , baseUrl ) ;
11+ }
Original file line number Diff line number Diff line change 99 import { _ } from ' svelte-i18n' ;
1010 import { userStore } from ' $lib/helpers/store' ;
1111 import { PUBLIC_SERVICE_URL } from ' $env/static/public' ;
12+ import { buildUrl } from ' $lib/helpers/utils/common' ;
1213
1314 /** @type {import('$types').UserModel} */
1415 let currentUser;
6970 on:drop ={e => handleFileDrop (e )}
7071 >
7172 <img
72- src ={` ${PUBLIC_SERVICE_URL }${ currentUser ?.avatar }?access_token=${$userStore ?.token } ` }
73+ src ={` ${buildUrl ( PUBLIC_SERVICE_URL , currentUser ?.avatar || ' ' ). href }?access_token=${$userStore ?.token } ` }
7374 alt =" "
7475 class =" img-thumbnail rounded-circle"
7576 style =" width: 100%; height: 100%;"
You can’t perform that action at this time.
0 commit comments