mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
17 lines
517 B
JavaScript
17 lines
517 B
JavaScript
|
import { Controller } from '@hotwired/stimulus';
|
||
|
import { Toast } from 'bootstrap';
|
||
|
|
||
|
export default class extends Controller {
|
||
|
connect() {
|
||
|
//Move all toasts from the page into our toast container and show them
|
||
|
|
||
|
const toastContainer = document.getElementById('toast-container');
|
||
|
if (this.element.parentNode !== toastContainer) {
|
||
|
toastContainer.appendChild(this.element);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
const toast = new Toast(this.element);
|
||
|
toast.show();
|
||
|
}
|
||
|
}
|