Skip to content
Snippets Groups Projects
about-us.component.ts 1.7 KiB
Newer Older
  • Learn to ignore specific revisions
  • import { Component, OnInit } from '@angular/core';
    
    Florian Azizian's avatar
    Florian Azizian committed
    import { LANG } from './translate.component';
    
    import { HeaderService } from '../service/header.service';
    
    import { AppService } from '../service/app.service';
    
    import { environment } from '../environments/environment';
    
    import {catchError, tap} from 'rxjs/operators';
    import {HttpClient} from '@angular/common/http';
    import {of} from 'rxjs/internal/observable/of';
    
    import {NotificationService} from '../service/notification/notification.service';
    
    Florian Azizian's avatar
    Florian Azizian committed
    
    @Component({
    
        templateUrl: 'about-us.component.html',
    
        styleUrls: ['about-us.component.css']
    
    Florian Azizian's avatar
    Florian Azizian committed
    })
    
    export class AboutUsComponent implements OnInit {
    
    
    Florian Azizian's avatar
    Florian Azizian committed
        lang: any = LANG;
    
        loading: boolean = false;
    
    
        commitHash: string = this.lang.undefined;
    
    
            public http: HttpClient,
            private notify: NotificationService,
    
            private headerService: HeaderService,
    
            public appService: AppService) { }
    
    Alex ORLUC's avatar
    Alex ORLUC committed
            this.headerService.setHeader(this.lang.aboutUs);
    
            this.applicationVersion = environment.VERSION;
    
    Florian Azizian's avatar
    Florian Azizian committed
            this.loading = false;
    
    
            await this.loadCommitInformation();
        }
    
        loadCommitInformation() {
            return new Promise((resolve) => {
                this.http.get('../rest/commitInformation').pipe(
                    tap((data: any) => {
                        this.commitHash = data.hash !== null ? data.hash : this.lang.undefined;
                        console.log(data);
                        resolve(true);
                    }),
                    catchError((err: any) => {
                        this.notify.handleSoftErrors(err);
                        return of(false);
                    })
                ).subscribe();
            });