File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
components/apis/api-details-page/ko/runtime Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -137,12 +137,9 @@ export class ApiDetailsPage {
137137 this . api ( api ) ;
138138 this . initializeBreadcrumbItems ( ) ;
139139
140- try {
141- const currentApiVersion = await this . apiService . getCurrentRevision ( apiName ) ;
142- this . lastModifiedDate ( new Date ( currentApiVersion . updatedDateTime ) . toLocaleDateString ( ) ) ;
143- }
144- catch ( error ) {
145- // do nothing
140+ const lastModifiedDate = await this . apiService . getLastModifiedDate ( `apis/${ apiName } ` ) ;
141+ if ( lastModifiedDate ) {
142+ this . lastModifiedDate ( new Date ( lastModifiedDate ) . toLocaleDateString ( ) ) ;
146143 }
147144
148145 this . apiLoading ( false ) ;
Original file line number Diff line number Diff line change @@ -579,13 +579,14 @@ export class ApiService {
579579 return new Wiki ( wikiContract ) ;
580580 }
581581
582- public async getCurrentRevision ( apiId : string ) : Promise < Revision > {
583- let query = `apis/${ apiId } /revisions` ;
584- query = Utils . addQueryParameter ( query , `isCurrent eq true` ) ;
585-
586- const revisionContract = await this . mapiClient . get < Page < RevisionContract > > ( query , [ await this . mapiClient . getPortalHeader ( "getCurrentRevision" ) ] ) ;
587- return new Revision ( revisionContract . value [ 0 ] ) ;
588- }
582+ public async getLastModifiedDate ( apiId : string ) : Promise < string > {
583+ let query = `${ apiId } /releases` ;
584+ query = Utils . addQueryParameter ( query , `$orderBy=createdDateTime` ) ;
585+ query = Utils . addQueryParameter ( query , `$top=1` ) ;
586+
587+ const changelog = await this . mapiClient . get < Page < ChangeLogContract > > ( query , [ await this . mapiClient . getPortalHeader ( "getApiChangeLog" ) ] ) ;
588+ return changelog ?. value [ 0 ] ?. properties . createdDateTime ;
589+ }
589590
590591 private mapApiTagResourceToOperationsByTags ( apiTagResource : PageContract < ApiTagResourceContract > ) : Page < TagGroup < Operation > > {
591592 const page = new Page < TagGroup < Operation > > ( ) ;
You can’t perform that action at this time.
0 commit comments