custom notifications service
This commit is contained in:
@@ -2,14 +2,13 @@ import { DatePipe } from '@angular/common';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { MatSort, MatSortable } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { AuthService } from 'src/app/auth/auth.service';
|
||||
import { Layer } from 'src/app/models/layer.model';
|
||||
import { Record } from 'src/app/models/record.model';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Component({
|
||||
@@ -29,12 +28,11 @@ export class LayerDetailComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private fb$: UntypedFormBuilder,
|
||||
private router$: Router,
|
||||
private http$: HttpClient,
|
||||
private route$: ActivatedRoute,
|
||||
private auth$: AuthService,
|
||||
private snackBar: MatSnackBar,
|
||||
private datePipe: DatePipe
|
||||
private datePipe: DatePipe,
|
||||
private notifications$: NotificationsService
|
||||
) { }
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -55,9 +53,13 @@ export class LayerDetailComponent implements OnInit {
|
||||
}
|
||||
async export() {
|
||||
if (await Layer.exportToGoogleSheet(this.document.id || "", this.http$)) {
|
||||
this.snackBar.open("Plik został zapisany na dysku Google", "OK");
|
||||
this.notifications$.add({
|
||||
text: "Plik został zapisany na dysku Google.",
|
||||
});
|
||||
} else {
|
||||
this.snackBar.open("Zapis się nie udał.", "OK");
|
||||
this.notifications$.add({
|
||||
text: "Zapis się nie udał.",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
Reference in New Issue
Block a user