Skip to content

Commit

Permalink
Handle token
Browse files Browse the repository at this point in the history
  • Loading branch information
dzole0311 committed Oct 4, 2024
1 parent ed34106 commit ca05c99
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ export const handleImageServiceRequest = async (event, variable, setChartData, s
}),
};

const token = process.env.GIS_TOKEN;

try {
const response = await fetch(url.toString(), { method: 'GET' });
const response = await fetch(url.toString(), {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`,
'Referer': 'https://earthdata.gov',
}
});

const results = await response.json();
// const results = mockData; // Uncomment this line to use mockData during testing

Expand Down

0 comments on commit ca05c99

Please sign in to comment.