Skip to content

fix: for issue #4784 #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/services/terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,21 @@ 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())));
} else {
termDetails = await this.private.api.get(`/terms/${termId}`)
.then(res => (res.ok ? res.json() : Promise.reject(res.json())));
}
return {
...termDetails,
isLegacyTerm,
};
}

/**
Expand Down