const csvGenerator = {
	init() {
		const downloadCsvBtnEl = document.querySelector(".js-download-csv-btn");
		if (downloadCsvBtnEl) {
      downloadCsvBtnEl.addEventListener("click", e => {
      	window.open(window.location.href, '_blank');
      });
    }
	}
}

export default csvGenerator;
const csvGenerator = {
	init() {
		const downloadCsvBtnEl = document.querySelector(".js-download-csv-btn");
		if (downloadCsvBtnEl) {
      downloadCsvBtnEl.addEventListener("click", e => {
      	let url = `${window.location.href}&returns=csv`;
      	window.open(url, '_blank');
      });
    }
	}
}

export default csvGenerator;
Refactor CSV generator button script