From ce0115122403f184402f59a993f00407cfc368a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gouin?= Date: Tue, 12 Mar 2024 14:13:32 +0100 Subject: [PATCH] fix cors --- main.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index 33034cd..c240214 100644 --- a/main.js +++ b/main.js @@ -224,11 +224,23 @@ let app = { this.available = []; this.error = ""; if (newValue) { - Papa.parse(newValue, { - download: true, - complete: this.dataComplete, - error: this.dataError, - }); + fetch(newValue, { + headers: { + Origin: window.location.host, + }, + }) + .then((response) => { + response + .text() + .then((content) => { + Papa.parse(content, { + complete: this.dataComplete, + error: this.dataError, + }); + }) + .catch(this.dataError); + }) + .catch(this.dataError); } }, multiple() {