Skip to content

Commit

Permalink
Fixing lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
davenichols-DHLS committed Aug 22, 2024
1 parent 0d62586 commit 8a66285
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions blocks/events/events.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-undef */
import { createOptimizedPicture, capitalizeWords, toClassName } from '../../scripts/aem.js';
import {
div, a, p, ul, li, article, span,
Expand All @@ -21,7 +22,7 @@ const TYPES = [

function filterUrl() {
function getUrlParameter(name) {
const newName = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
const newName = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
const regex = new RegExp(`[\\?&]${newName}=([^&#]*)`);
const results = regex.exec(window.location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
Expand Down Expand Up @@ -190,21 +191,20 @@ function handleCheckboxChange(eventData) {
const urlParams = new URLSearchParams(window.location.search);
urlParams.delete('types');
if (eventTypes.length > 0) {
urlParams.set('type', eventTypes.map(type => type.toLowerCase()).join(','));
urlParams.set('type', eventTypes.map((type) => type.toLowerCase()).join(','));
} else {
urlParams.delete('types');
}

if (regions.length > 0) {
urlParams.delete('region');
urlParams.set('region', regions.map(region => region.toLowerCase().replace(/[+\s]/g, '-')).join(','));
urlParams.set('region', regions.map((region) => region.toLowerCase().replace(/[+\s]/g, '-')).join(','));
} else {
urlParams.delete('region');
}

const newUrl = `${window.location.pathname}?${urlParams.toString()}`;
window.history.replaceState({}, '', newUrl);

} else {
filteredEvents = eventData;
}
Expand Down

0 comments on commit 8a66285

Please sign in to comment.