1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

clean up typescript initialization

This commit is contained in:
checktheroads
2021-04-20 09:34:12 -07:00
parent 0aa8fc2fc2
commit 99f0e31810
26 changed files with 312 additions and 414 deletions

View File

@ -0,0 +1,16 @@
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();
}
}
}