Skip to content

Commit

Permalink
Update 12-exercises.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorSvertoka committed Dec 15, 2023
1 parent b46aa72 commit d6dc93b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/js/12-exercises.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ async function onCardClick(event) {
return;
}
const item = event.target.closest('.filters__item');
console.log(item);
const filter = item.children[0].innerText.toLowerCase();
const name = item.children[1].innerText.toLowerCase();
console.log(item.lastElementChild);

let filter = item.lastElementChild.children[0].innerText
.toLowerCase()
.replace(/\s/g, '');
const name = item.lastElementChild.children[1].innerText
.toLowerCase()
.replace(/\s/g, '%20');

if (filter === 'bodyparts') {
filter = 'bodypart';
}

console.log(filter);
console.log('get');
try {
const data = await apiService.getExercises(filter, name);
renderExercises(data);
Expand Down

0 comments on commit d6dc93b

Please sign in to comment.