import { Component , Input , OnInit } from '@angular/core' ; import { Client } from '../../../../services/api/client' ; import { Session } from '../../../../services/session' ; import { ActivatedRoute , Router } from '@angular/router' ; @ Component ( { selector : 'm-helpdesk--questions--related' , templateUrl : 'related.component.html' , } ) export class RelatedQuestionsComponent implements OnInit { @ Input ( ) question ; posts : any [ ] = [ ] ; inProgress : boolean = false ; constructor ( public client , public session , public router , private route ) { } ngOnInit ( ) { this . load ( ) ; } async load ( ) { this . inProgress = true ; this . posts = [ ] ; try { const response = await this . client . get ( `api/v2/helpdesk/relatedposts` , { limit : 8 , q : this . question . question , } ) ; this . posts = response . posts ; } catch ( e ) { console . error ( e ) ; } finally { this . inProgress = false ; } } }