Skip to content

Commit

Permalink
Merge pull request #2265 from Plant-for-the-Planet-org/develop
Browse files Browse the repository at this point in the history
Release: Fix for caching issue in info seen for data explorer
  • Loading branch information
mohitb35 authored Oct 16, 2024
2 parents 4b18094 + 3f16d2b commit 4a77db4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion pages/api/data-explorer/species-planted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ handler.post(async (req, response) => {

const { projectId, startDate, endDate } = req.body;

const CACHE_KEY = `SPECIES_PLANTED__${getCachedKey(
const cachingKeyPrefix =
process.env.API_ENDPOINT?.replace('https://', '').split('.')[0] ||
'env_missing';

const CACHE_KEY = `${cachingKeyPrefix}_SPECIES_PLANTED__${getCachedKey(
projectId,
startDate,
endDate
Expand Down
6 changes: 5 additions & 1 deletion pages/api/data-explorer/total-species-planted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ handler.post(async (req, response) => {

const { projectId, startDate, endDate } = req.body;

const CACHE_KEY = `TOTAL_SPECIES_PLANTED__${getCachedKey(
const cachingKeyPrefix =
process.env.API_ENDPOINT?.replace('https://', '').split('.')[0] ||
'env_missing';

const CACHE_KEY = `${cachingKeyPrefix}_TOTAL_SPECIES_PLANTED__${getCachedKey(
projectId,
startDate,
endDate
Expand Down
6 changes: 5 additions & 1 deletion pages/api/data-explorer/total-trees-planted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ handler.post(async (req, response) => {

const { projectId, startDate, endDate } = req.body;

const CACHE_KEY = `TOTAL_TREES_PLANTED__${getCachedKey(
const cachingKeyPrefix =
process.env.API_ENDPOINT?.replace('https://', '').split('.')[0] ||
'env_missing';

const CACHE_KEY = `${cachingKeyPrefix}_TOTAL_TREES_PLANTED__${getCachedKey(
projectId,
startDate,
endDate
Expand Down
6 changes: 5 additions & 1 deletion pages/api/data-explorer/trees-planted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ handler.post(async (req, response) => {
const { projectId, startDate, endDate } = req.body;
const { timeFrame } = req.query;

const CACHE_KEY = `TREES_PLANTED__${getCachedKey(
const cachingKeyPrefix =
process.env.API_ENDPOINT?.replace('https://', '').split('.')[0] ||
'env_missing';

const CACHE_KEY = `${cachingKeyPrefix}_TREES_PLANTED__${getCachedKey(
projectId,
startDate,
endDate,
Expand Down

0 comments on commit 4a77db4

Please sign in to comment.