aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/services/toasts.service.ts
diff options
context:
space:
mode:
authorGunther6070 <haydenhartman10@yahoo.com>2025-04-01 07:47:16 -0400
committerGunther6070 <haydenhartman10@yahoo.com>2025-04-01 07:47:16 -0400
commitd8330f1ac85b26d08ca4df5ce3875078d7b4f47f (patch)
tree2046e58c146097aac21c9e352771420c31df6589 /ufund-ui/src/app/services/toasts.service.ts
parentbc9d3417795d841b4cb3e9fb022f8d61448af946 (diff)
parent233fe120d2a9b30e0150401ebdfeb946dc9c2c07 (diff)
downloadJellySolutions-d8330f1ac85b26d08ca4df5ce3875078d7b4f47f.tar.gz
JellySolutions-d8330f1ac85b26d08ca4df5ce3875078d7b4f47f.tar.bz2
JellySolutions-d8330f1ac85b26d08ca4df5ce3875078d7b4f47f.zip
Merge branch 'main' of https://github.com/RIT-SWEN-261-02/team-project-2245-swen-261-02-2b
Diffstat (limited to '')
-rw-r--r--ufund-ui/src/app/services/toasts.service.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/ufund-ui/src/app/services/toasts.service.ts b/ufund-ui/src/app/services/toasts.service.ts
new file mode 100644
index 0000000..4fd024e
--- /dev/null
+++ b/ufund-ui/src/app/services/toasts.service.ts
@@ -0,0 +1,27 @@
+import {Injectable, ViewContainerRef} from '@angular/core';
+import {ToastComponent} from '../components/toast/toast.component';
+
+export enum ToastType {
+ INFO,
+ WARNING,
+ ERROR
+}
+
+@Injectable({
+ providedIn: 'root'
+})
+export class ToastsService {
+
+ private vcr?: ViewContainerRef
+
+ sendToast(type: ToastType, message: string, action?: {label: string, onAction: () => void}) {
+ let compRef = this.vcr?.createComponent(ToastComponent)!
+ compRef.setInput("message", message)
+ compRef.setInput("type", type)
+ compRef.setInput("action", action)
+ }
+
+ setRootViewContainerRef(vcr: ViewContainerRef) {
+ this.vcr = vcr
+ }
+}