Skip to content

Commit 347a416

Browse files
committed
Switch JSON fetch to GitHub Contents API to bypass CDN caching
1 parent 3d60473 commit 347a416

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

webapp/picklist.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ <h1 id="page-title">Picklist</h1>
204204
}
205205

206206
async function fetchData() {
207-
const url = `https://raw.githubusercontent.com/FRC4607/Scouting-Analysis/main/webapp/latest_picklist.json?t=${Date.now()}`;
208-
const resp = await fetch(url);
207+
const url = `https://api.github.com/repos/FRC4607/Scouting-Analysis/contents/webapp/latest_picklist.json`;
208+
const resp = await fetch(url, { headers: { 'Accept': 'application/vnd.github.v3.raw' } });
209209
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
210210
return await resp.json();
211211
}

webapp/planner.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ <h1 id="page-title">Match Planner</h1>
175175
let FIRST_EVENT_TEAMS = new Set();
176176

177177
async function fetchSheetData() {
178-
const url = `https://raw.githubusercontent.com/FRC4607/Scouting-Analysis/main/webapp/latest_planner.json?t=${Date.now()}`;
179-
const resp = await fetch(url);
178+
const url = `https://api.github.com/repos/FRC4607/Scouting-Analysis/contents/webapp/latest_planner.json`;
179+
const resp = await fetch(url, { headers: { 'Accept': 'application/vnd.github.v3.raw' } });
180180
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
181181
return await resp.json();
182182
}

0 commit comments

Comments
 (0)