aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/about/about.component.ts
blob: 6a2e59be18476b7762ddadffbdb30859e27cafff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Component, OnInit } from '@angular/core'
import { ServerService } from '@app/core'
import { MarkdownService } from '@app/videos/shared'
import { NotificationsService } from 'angular2-notifications'

@Component({
  selector: 'my-about',
  templateUrl: './about.component.html',
  styleUrls: [ './about.component.scss' ]
})

export class AboutComponent implements OnInit {
  descriptionHTML = ''
  termsHTML = ''

  constructor (
    private notificationsService: NotificationsService,
    private serverService: ServerService,
    private markdownService: MarkdownService
  ) {}

  get instanceName () {
    return this.serverService.getConfig().instance.name
  }

  ngOnInit () {
    this.serverService.getAbout()
      .subscribe(
        res => {
          this.descriptionHTML = this.markdownService.markdownToHTML(res.instance.description)
          this.termsHTML = this.markdownService.markdownToHTML(res.instance.terms)
        },

        err => this.notificationsService.error('Error', err)
      )
  }

}