diff --git a/.circleci/config.yml b/.circleci/config.yml index 0e161844..e8eac28e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,7 @@ jobs: - attach_workspace: at: . - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - - run: npm publish + - run: npm publish --tag test-release # dont change anything workflows: version: 2 diff --git a/package.json b/package.json index 20f49c6f..16989639 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .", "test": "npm run lint && npm run jest" }, - "version": "1.0.5", + "version": "1000.22.10", "dependencies": { "auth0-js": "^6.8.4", "config": "^3.2.0", diff --git a/src/services/terms.js b/src/services/terms.js index 82184f1b..affd8ad9 100644 --- a/src/services/terms.js +++ b/src/services/terms.js @@ -95,10 +95,22 @@ class TermsService { * @param {Number|String} termId id of the term * @return {Promise} promise of the request result */ - getTermDetails(termId) { - // looks like server cache responses, to prevent it we add nocache param with always new value - return this.private.api.get(`/terms/${termId}`) - .then(res => (res.ok ? res.json() : Promise.reject(res.json()))); + async getTermDetails(termId) { + let termDetails = {}; + let isLegacyTerm = false; + if (/^[\d]{5,8}$/.test(termId)) { + isLegacyTerm = true; + termDetails = await this.private.api.get(`/terms?legacyId=${termId}`) + .then(res => (res.ok ? res.json() : Promise.reject(res.json()))) + .then(res => (res.result ? res.result[0] : Promise.reject(res.json()))); + } else { + termDetails = await this.private.api.get(`/terms/${termId}`) + .then(res => (res.ok ? res.json() : Promise.reject(res.json()))); + } + return { + ...termDetails, + isLegacyTerm, + }; } /**