File tree 1 file changed +15
-4
lines changed
1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -95,10 +95,21 @@ class TermsService {
95
95
* @param {Number|String } termId id of the term
96
96
* @return {Promise } promise of the request result
97
97
*/
98
- getTermDetails ( termId ) {
99
- // looks like server cache responses, to prevent it we add nocache param with always new value
100
- return this . private . api . get ( `/terms/${ termId } ` )
101
- . then ( res => ( res . ok ? res . json ( ) : Promise . reject ( res . json ( ) ) ) ) ;
98
+ async getTermDetails ( termId ) {
99
+ let termDetails = { } ;
100
+ let isLegacyTerm = false ;
101
+ if ( / ^ [ \d ] { 5 , 8 } $ / . test ( termId ) ) {
102
+ isLegacyTerm = true ;
103
+ termDetails = await this . private . api . get ( `/terms?legacyId=${ termId } ` )
104
+ . then ( res => ( res . ok ? res . json ( ) : Promise . reject ( res . json ( ) ) ) ) ;
105
+ } else {
106
+ termDetails = await this . private . api . get ( `/terms/${ termId } ` )
107
+ . then ( res => ( res . ok ? res . json ( ) : Promise . reject ( res . json ( ) ) ) ) ;
108
+ }
109
+ return {
110
+ ...termDetails ,
111
+ isLegacyTerm,
112
+ } ;
102
113
}
103
114
104
115
/**
You can’t perform that action at this time.
0 commit comments