Skip to content

Commit

Permalink
add a cache buster parameter to the forecast JSON request
Browse files Browse the repository at this point in the history
  • Loading branch information
erral committed Nov 3, 2023
1 parent a4b3abc commit fce96a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/euskalmet.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const getForecastUrl = (city) => {
return `https://raw.githubusercontent.com/erral/eguraldi_iragarpena/main/forecasts/${city}-euskalmet.json`;
// Add a cache buster parameter that changes every 4 hours
// in order to avoid caching the JSON with the forecast
// in the client's browser
const cache_buster = parseInt(new Date().getTime() / (1000 * 60 * 60 * 4));
return `https://raw.githubusercontent.com/erral/eguraldi_iragarpena/main/forecasts/${city}-euskalmet.json?time=${cache_buster}`;
};

const AVAILABLE_LANGUAGES = {
Expand Down

0 comments on commit fce96a9

Please sign in to comment.