Added the ability to view logs from the settings menu

This commit is contained in:
Isaac Grynsztein
2020-06-22 23:15:21 -04:00
parent 09d8ce04d7
commit 2998562655
14 changed files with 94 additions and 6 deletions

View File

@@ -0,0 +1,32 @@
import { Component, OnInit } from '@angular/core';
import { PostsService } from '../../posts.services';
@Component({
selector: 'app-logs-viewer',
templateUrl: './logs-viewer.component.html',
styleUrls: ['./logs-viewer.component.scss']
})
export class LogsViewerComponent implements OnInit {
logs: string = null;
constructor(private postsService: PostsService) { }
ngOnInit(): void {
this.getLogs();
}
getLogs() {
this.postsService.getLogs().subscribe(res => {
if (res['logs']) {
this.logs = res['logs'];
} else {
this.postsService.openSnackBar('Failed to retrieve logs!');
}
}, err => {
console.error(err);
this.postsService.openSnackBar('Failed to retrieve logs!');
});
}
}