What I am trying to do here, is to make an object that was returned from axios (front-end) known in the pug template so I can use it in multiple places. But I don't want to create the markeup and inject the data (because it will take me long) is this dowable? thank you in advance
The axios function below returns the carSearch, which is an object, and it is the same object I want to use in the pug template for example make it as global object inside the pug template.
const btnSearchBodyType = document.querySelectorAll('.car-type');
let carBody = {};
btnSearchBodyType.forEach((el) =>
el.addEventListener('click', async function() {
carBody['body style'] = el.className.split(' ')[1];
console.log(carBody);
const carSearch = await searchBodyType(
carBody, ['body style'],
el.className.split(' ')[1]
);
console.log(carSearch);
})
);