File tree Expand file tree Collapse file tree 4 files changed +40
-12
lines changed
Expand file tree Collapse file tree 4 files changed +40
-12
lines changed Original file line number Diff line number Diff line change 4949<script >
5050import { IKImage , IKContext , IKUpload } from " imagekitio-vue" ;
5151
52+ let urlEndpoint= process .env .VUE_APP_URL_ENDPOINT ;
53+ if (urlEndpoint[urlEndpoint .length - 1 ] === " /" )
54+ urlEndpoint = urlEndpoint .slice (0 ,urlEndpoint .length - 1 );
55+
56+ let path = " /default-image.jpg" ;
57+ if (path[0 ] === " /" )
58+ path = path .split (" /" )[1 ];
59+
5260export default {
5361 name: " app" ,
5462 components: {
@@ -58,11 +66,11 @@ export default {
5866 },
5967 data () {
6068 return {
61- urlEndpoint: process . env . VUE_APP_URL_ENDPOINT ,
69+ urlEndpoint: urlEndpoint ,
6270 publicKey: process .env .VUE_APP_PUBLIC_KEY ,
6371 authenticationEndpoint: process .env .VUE_APP_AUTHENTICATION_ENDPOINT ,
64- path: " default-image.jpg " ,
65- src: ` ${ urlEndpoint}${ path} `
72+ path: path ,
73+ src: ` ${ urlEndpoint} / ${ path} `
6674 };
6775 }
6876};
Original file line number Diff line number Diff line change @@ -4,11 +4,17 @@ export default {
44 title : 'IKContext' ,
55} ;
66
7-
8- const urlEndpoint = process . env . VUE_APP_URL_ENDPOINT ;
97const publicKey = process . env . VUE_APP_PUBLIC_KEY ;
10- const path = "default-image.jpg" ;
11- const src = `${ urlEndpoint } ${ path } ` ;
8+
9+ let urlEndpoint = process . env . VUE_APP_URL_ENDPOINT ;
10+ if ( urlEndpoint [ urlEndpoint . length - 1 ] === "/" )
11+ urlEndpoint = urlEndpoint . slice ( 0 , urlEndpoint . length - 1 ) ;
12+
13+ let path = "/default-image.jpg" ;
14+ if ( path [ 0 ] === "/" )
15+ path = path . split ( "/" ) [ 1 ] ;
16+
17+ const src = `${ urlEndpoint } /${ path } ` ;
1218
1319export const imageWithContext = ( ) => ( {
1420 components : { IKImage, IKContext } ,
Original file line number Diff line number Diff line change @@ -4,9 +4,16 @@ export default {
44 title : 'IKImage' ,
55} ;
66
7- const urlEndpoint = process . env . VUE_APP_URL_ENDPOINT ;
87const publicKey = process . env . VUE_APP_PUBLIC_KEY ;
9- const path = "default-image.jpg" ;
8+
9+ let urlEndpoint = process . env . VUE_APP_URL_ENDPOINT ;
10+ if ( urlEndpoint [ urlEndpoint . length - 1 ] === "/" )
11+ urlEndpoint = urlEndpoint . slice ( 0 , urlEndpoint . length - 1 ) ;
12+
13+ let path = "/default-image.jpg" ;
14+ if ( path [ 0 ] === "/" )
15+ path = path . split ( "/" ) [ 1 ] ;
16+
1017const src = `${ urlEndpoint } ${ path } ` ;
1118
1219export const imageWithSrc = ( ) => ( {
Original file line number Diff line number Diff line change @@ -4,10 +4,17 @@ export default {
44 title : 'Transformations' ,
55} ;
66
7- const urlEndpoint = process . env . VUE_APP_URL_ENDPOINT ;
87const publicKey = process . env . VUE_APP_PUBLIC_KEY ;
9- const path = "default-image.jpg" ;
10- const src = `${ urlEndpoint } ${ path } ` ;
8+
9+ let urlEndpoint = process . env . VUE_APP_URL_ENDPOINT ;
10+ if ( urlEndpoint [ urlEndpoint . length - 1 ] === "/" )
11+ urlEndpoint = urlEndpoint . slice ( 0 , urlEndpoint . length - 1 ) ;
12+
13+ let path = "/default-image.jpg" ;
14+ if ( path [ 0 ] === "/" )
15+ path = path . split ( "/" ) [ 1 ] ;
16+
17+ const src = `${ urlEndpoint } /${ path } ` ;
1118
1219export const imageWithTransformation = ( ) => ( {
1320 components : { IKImage } ,
You can’t perform that action at this time.
0 commit comments