Skip to content

Commit 6e3ef74

Browse files
committed
chore: enhance alert method to conditionally add toast notifications
1 parent 6fe5279 commit 6e3ef74

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

adminforth/spa/src/adminforth.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,15 @@ class FrontendAPI implements FrontendAPIInterface {
110110
onResolve: (value?: any) => resolve(String(value ?? '')),
111111
})
112112
})
113+
} else {
114+
this.toastStore.addToast({
115+
message: params.message,
116+
messageHtml: params.messageHtml,
117+
variant: params.variant,
118+
timeout: params.timeout,
119+
buttons: params.buttons,
120+
})
113121
}
114-
this.toastStore.addToast({
115-
message: params.message,
116-
messageHtml: params.messageHtml,
117-
variant: params.variant,
118-
timeout: params.timeout,
119-
buttons: params.buttons,
120-
})
121122
}
122123

123124
listFilterValidation(filter: FilterParams): boolean {

adminforth/types/FrontendAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export type AlertParams = {
183183
/**
184184
* Optional buttons to display in the alert
185185
*/
186-
buttons?: {value: any, label: string}[]
186+
buttons?: {value: any, label: string}[];
187187

188188
}
189189

0 commit comments

Comments
 (0)