+
+ {{flashmessage.body}}
+
+
+ {{flashmessage.body}}
+
+
+ {{flashmessage.body}}
+
+
+
+
diff --git a/front/app/src/app/layout/flashmessages/flashmessages.service.ts b/front/app/src/app/layout/flashmessages/flashmessages.service.ts
index 59d50c42..ff0e5c8b 100644
--- a/front/app/src/app/layout/flashmessages/flashmessages.service.ts
+++ b/front/app/src/app/layout/flashmessages/flashmessages.service.ts
@@ -1,20 +1,34 @@
import {Injectable} from "@angular/core";
export interface Flashmessage {
- header: string;
- body: string;
- delay?: number;
+ body: string;
+ delay?: number;
+ type: "Error"|"Success"|"Info";
}
@Injectable({ providedIn: 'root' })
export class FlashmessagesService {
- toasts: Flashmessage[] = [];
+ toasts: Flashmessage[] = [];
- show(header: string, body: string) {
- this.toasts.push({ header, body });
- }
+ success(body: string) {
+ this.show("Success", body);
+ }
- remove(toast: Flashmessage) {
- this.toasts = this.toasts.filter(t => t != toast);
- }
+ error(body: string) {
+ this.show("Error", body);
+ }
+
+ show(type: string, body: string) {
+ if (type == "Success") {
+ this.toasts.push({ type, body });
+ } else if (type == "Error") {
+ this.toasts.push({ type, body });
+ } else {
+ this.toasts.push({ type: "Info", body });
+ }
+ }
+
+ remove(toast: Flashmessage) {
+ this.toasts = this.toasts.filter(t => t != toast);
+ }
}
\ No newline at end of file