Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

43 строки
1.1 KiB

  1. import {Component, OnInit} from '@angular/core';
  2. import {AccountService} from './_services';
  3. import {User} from './_models';
  4. import {TranslateService} from "@ngx-translate/core";
  5. import {environment} from "@environments/environment";
  6. @Component({
  7. selector: 'app-root',
  8. templateUrl: 'app.component.html',
  9. styleUrl: 'app.component.scss'
  10. })
  11. export class AppComponent implements OnInit {
  12. protected readonly environment = environment;
  13. protected user?: User | null;
  14. constructor(
  15. private accountService: AccountService,
  16. translate: TranslateService
  17. ) {
  18. translate.setDefaultLang('de');
  19. translate.use('de');
  20. this.accountService.user.subscribe(x => this.user = x);
  21. }
  22. ngOnInit(): void {
  23. }
  24. logout() {
  25. this.accountService.logout();
  26. }
  27. // TODO: Hilfsfunktion - entfernen
  28. copyTokenToClipboard() {
  29. const el = document.createElement('textarea');
  30. el.value = this.user?.token !== undefined ? this.user.token : "";
  31. document.body.appendChild(el);
  32. el.select();
  33. document.execCommand('copy');
  34. document.body.removeChild(el);
  35. }
  36. }