Skip to content

Commit

Permalink
Merge branch 'develop' into add-google-analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
dzole0311 committed Oct 8, 2024
2 parents aae4491 + 3b1b1f0 commit f2c79ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ jobs:
GOOGLE_TAG_MANAGER_ID: ${{secrets.GOOGLE_TAG_MANAGER_ID}}
GOOGLE_TAG_AUTH: ${{secrets.GOOGLE_TAG_AUTH}}
GOOGLE_TAG_PREVIEW: ${{secrets.GOOGLE_TAG_PREVIEW}}
VITE_GIS_TOKEN: ${{secrets.GIS_TOKEN}}
VITE_REFERER: ${{vars.GIS_REFERER}}
run: |
npm install
npm run build
Expand Down
10 changes: 9 additions & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ export const handleImageServiceRequest = async (event, variable, setChartData, s
};

try {
const response = await fetch(url.toString(), { method: 'GET' });
const token = import.meta.env.VITE_GIS_TOKEN ?? '';
const referer = import.meta.env.VITE_REFERER ?? 'https://earth.gov';
const response = await fetch(url.toString(), {
method: 'GET',
headers: {
'X-Esri-Authorization': `Bearer ${token}`,
'Referer': `${referer}`,
}
});
const results = await response.json();
// const results = mockData; // Uncomment this line to use mockData during testing

Expand Down

0 comments on commit f2c79ad

Please sign in to comment.