mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-07-07 21:20:17 +02:00
Refetch search query when the input is updated
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
function initModal(target, url, content_id = 'form-content') {
|
||||
function initModal(target, url, content_id = 'form-content', always_refetch = false) {
|
||||
document.querySelectorAll('[data-bs-target="#' + target + 'Modal"]')
|
||||
.forEach(elem => elem.addEventListener('click', () => {
|
||||
let modalBody = document.querySelector("#" + target + "Modal div.modal-body")
|
||||
|
||||
if (!modalBody.innerHTML.trim()) {
|
||||
if (!modalBody.innerHTML.trim() || always_refetch) {
|
||||
if (url instanceof Function) url = url()
|
||||
|
||||
fetch(url, {headers: {'CONTENT-ONLY': '1'}})
|
||||
|
Reference in New Issue
Block a user