Skip to content

Commit

Permalink
fix token consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
Doris Lam committed Apr 24, 2024
1 parent 01346ab commit 23f3f09
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ve-utils/application/Image.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ export class ImageService {
if (src.indexOf('http') < 0) {
src = this.veConfig.apiUrl + src;
}
let existingToken = src.indexOf('?token=');
if (existingToken > 0) {
src = src.substring(0, existingToken)
const url = new window.URL(src);
const params = new window.URLSearchParams(url.search);
if (params.has('token')) {
params.delete('token');
}
imgDom.attr('src', src + '?token=' + this.authSvc.getToken());
params.append('token', this.authSvc.getToken());
url.search = params.toString();
src = url.toString();
imgDom.attr('src', src);
if (imgDom.width() < 860) {
//keep image relative centered with text if less than 9 in
return;
Expand Down

0 comments on commit 23f3f09

Please sign in to comment.