From 73f2215c07e4188bc762088c761ea312f076a2a6 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 11 May 2023 13:04:09 +0300 Subject: [PATCH] Modal: Fix UIkit undefined in server --- utils/modal/alert.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/modal/alert.ts b/utils/modal/alert.ts index d43ab3f2..2c79afbb 100644 --- a/utils/modal/alert.ts +++ b/utils/modal/alert.ts @@ -185,14 +185,16 @@ export class AlertModal implements OnInit, AfterViewInit, OnDestroy { * Opens an alert window creating backdrop. */ open() { - UIkit.modal(this.element.nativeElement).show(); + if(typeof UIkit !== "undefined") { + UIkit.modal(this.element.nativeElement).show(); + } } /** * ok method closes the modal and emits modalOutput. */ ok() { - if (!this.stayOpen) { + if (!this.stayOpen && typeof UIkit !== "undefined") { UIkit.modal(this.element.nativeElement).hide(); } if (!this.choice) { @@ -209,6 +211,8 @@ export class AlertModal implements OnInit, AfterViewInit, OnDestroy { * cancel method closes the modal. */ cancel() { - UIkit.modal(this.element.nativeElement).hide(); + if(typeof UIkit !== "undefined") { + UIkit.modal(this.element.nativeElement).hide(); + } } }