-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the external api based on either the external site repo, api_u…
…rl or the fallback amsterdam repo
- Loading branch information
1 parent
1603865
commit b418d7a
Showing
1 changed file
with
11 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
}; |
b418d7a
There was a problem hiding this comment.
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