adding a return to prevent erros when elements not on the page
This commit is contained in:
parent
335f7ea088
commit
40728d2945
|
|
@ -148,12 +148,15 @@ export default function filterPublicationsInit() {
|
||||||
const filterButtons = document.querySelectorAll('.filters-toolbar__action-button');
|
const filterButtons = document.querySelectorAll('.filters-toolbar__action-button');
|
||||||
const loadAllbutton = document.querySelector('.filters-toolbar__action-button--load-all');
|
const loadAllbutton = document.querySelector('.filters-toolbar__action-button--load-all');
|
||||||
|
|
||||||
|
if (!filterButtons) return;
|
||||||
filterButtons.forEach((button) => {
|
filterButtons.forEach((button) => {
|
||||||
const publicationType = button.getAttribute('data-publication-type');
|
const publicationType = button.getAttribute('data-publication-type');
|
||||||
button.addEventListener('click', (e) => {
|
button.addEventListener('click', (e) => {
|
||||||
filterPublications(publicationType, e);
|
filterPublications(publicationType, e);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!loadAllbutton) return;
|
||||||
loadAllbutton.addEventListener('click', (e) => {
|
loadAllbutton.addEventListener('click', (e) => {
|
||||||
const publicationType = loadAllbutton.getAttribute('data-publication-type');
|
const publicationType = loadAllbutton.getAttribute('data-publication-type');
|
||||||
filterPublications(publicationType, e);
|
filterPublications(publicationType, e);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user