Skip to content

Commit

Permalink
Change the external api based on either the external site repo, api_u…
Browse files Browse the repository at this point in the history
…rl or the fallback amsterdam repo
  • Loading branch information
LorenzoJokhan committed Jan 11, 2024
1 parent 1603865 commit b418d7a
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions services/externalSiteApi.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
const fetch = require('node-fetch');
const apiUrl = process.env.EXTERNAL_SITE_REPO || 'https://api.openstad.amsterdam.nl/api/repo';
const siteApiKey = process.env.SITE_API_KEY;
const apiUrl =
process.env.EXTERNAL_SITE_REPO || process.env.API_URL
? `${process.env.API_URL}/api/repo`
: undefined || 'https://api.openstad.amsterdam.nl/api/repo';
const siteApiKey = process.env.SITE_API_KEY;

exports.fetchAll = async () => {
try {
let response = await fetch(`${apiUrl}`, {
headers: { "Content-type": "application/json" },
headers: { 'Content-type': 'application/json' },
method: 'GET',
})
});
if (!response.ok) {
console.log(response);
throw new Error('Fetch failed')
throw new Error('Fetch failed');
}
return await response.json();
} catch(err) {
return await response.json();
} catch (err) {
console.log(err);
}
}
};

1 comment on commit b418d7a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published new image: openstad/admin:Enable-own-template-store-b418d7a

Please sign in to comment.