Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
ULMS-1833 Added Nginx cache bypass method
Browse files Browse the repository at this point in the history
  • Loading branch information
dkvovik committed Apr 27, 2022
1 parent 93cb7bc commit 3c8d539
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/profile",
"version": "0.3.0",
"version": "0.3.1",
"description": "JavaScript API-client for Profile service",
"files": [
"es",
Expand Down
4 changes: 4 additions & 0 deletions src/profile-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class ProfileService {
reject(error)
}

forceReadProfile (id, scope) {
return this._client.getProfile(id, scope, true)
}

readMeProfile (scope) {
return this._client.getProfile('me', scope)
}
Expand Down
7 changes: 6 additions & 1 deletion src/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ export class HttpProfileResource {
'content-type': 'application/json'
}
}
getProfile (id, scope) {
getProfile (id, scope, force = false) {
let qs = ''

if (scope) {
qs = `?scope=${scope}`
}

// to avoid Nginx cache
if (force) {
qs += `${qs.length ? '&' : '?'}timestamp=${new Date().getTime()}`
}

return this.tokenProvider.getToken()
.then((token) =>
this.httpClient.get(
Expand Down

0 comments on commit 3c8d539

Please sign in to comment.