You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
frontend/src/app/components/option-picker/option-picker.component.ts

31 lines
818 B

import {Component, Input, OnInit} from '@angular/core';
import {Router} from '@angular/router';
import {ApiService} from '../../service/api.service';
@Component({
selector: 'app-option-picker',
templateUrl: './option-picker.component.html',
styleUrls: ['./option-picker.component.scss'],
})
export class OptionPickerComponent implements OnInit {
@Input() toggleDark: () => void;
@Input() isDark: () => boolean;
constructor(
protected api: ApiService,
protected router: Router,
) { }
ngOnInit() {}
onSelect(key) {
if ( key === 'html_export' ) {
window.open(this.api._build_url('/data/export/html'), '_blank');
} else if ( key === 'logout' ) {
window.location.href = '/auth/logout';
} else if ( key === 'toggle_darkmode' ) {
this.toggleDark();
}
}
}