mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
17 lines
430 B
TypeScript
17 lines
430 B
TypeScript
import { Toast } from 'bootstrap';
|
|
|
|
/**
|
|
* Find any active messages from django.contrib.messages and show them in a toast.
|
|
*/
|
|
export function initMessages(): void {
|
|
const elements = document.querySelectorAll<HTMLDivElement>(
|
|
'body > div#django-messages > div.django-message.toast',
|
|
);
|
|
for (const element of elements) {
|
|
if (element !== null) {
|
|
const toast = new Toast(element);
|
|
toast.show();
|
|
}
|
|
}
|
|
}
|