feat: notification component

This commit is contained in:
2024-07-10 23:02:14 +03:00
parent d1e32a94ca
commit 03b200c829
9 changed files with 134 additions and 11 deletions

View File

@@ -0,0 +1,32 @@
import { Injectable } from "@angular/core";
import { Subject } from "rxjs";
import { INotification } from "./notification.dto";
@Injectable({
providedIn: "root",
})
export class NotificationService {
readonly notification$ = new Subject<INotification>();
private sendNotification(message: INotification) {
this.notification$.next(message);
}
info(message: string, title: string = "", time = 3000) {
this.sendNotification({
message,
isError: false,
time: time,
name: title,
});
}
error(message: string, title: string = "", time = 3000) {
this.sendNotification({
message,
isError: true,
time: time,
name: title,
});
}
}