Skip to content

Commit

Permalink
hot: Add Cloudflare headers (#496)
Browse files Browse the repository at this point in the history
add Cloudflare headers
  • Loading branch information
justraman authored Jul 12, 2023
1 parent 00bfe24 commit 38ca9a8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mappings/util/marketplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ export async function fetchAccountsDetail(ids: string[]) {
if (!config.shouldFetchAccounts) {
return ids.map(() => null)
}

const { data } = await axios.post<{ data: { result: AddressVerification[] } } | { errors: any }>(
`${config.marketplaceUrl}/graphql/internal`,
{
query: addressesQuery,
variables: {
ids,
},
},
{
headers: {
'CF-Access-Client-Id': process.env.CF_ACCESS_CLIENT_ID,
'CF-Access-Client-Secret': process.env.CF_ACCESS_CLIENT_SECRET,
},
}
)

Expand All @@ -39,6 +46,7 @@ export async function fetchAccountsDetail(ids: string[]) {
console.error('No data returned', data)
throw new Error('No data returned')
}

return ids.map((id) => {
const account = data.data.result.find((i) => i.publicKey === id)
if (!account) return null
Expand Down

0 comments on commit 38ca9a8

Please sign in to comment.