Use VERCEL_URL in /api/outfitImage
Ah right, this is how we get the deployed API code to know its own hostname! This way, when we do a preview deploy, /api/outfitImage will use the preview version of the GraphQL endpoint, too.
This commit is contained in:
parent
5e657e7547
commit
d31809cc62
1 changed files with 5 additions and 4 deletions
|
@ -118,8 +118,9 @@ async function handle(req, res) {
|
||||||
return res.send(image);
|
return res.send(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
const GRAPHQL_ENDPOINT =
|
const GRAPHQL_ENDPOINT = process.env.VERCEL_URL
|
||||||
process.env.NODE_ENV === "development"
|
? `https://${process.env.VERCEL_URL}/api/graphql`
|
||||||
|
: process.env.NODE_ENV === "development"
|
||||||
? "http://localhost:3000/api/graphql"
|
? "http://localhost:3000/api/graphql"
|
||||||
: "https://impress-2020.openneo.net/api/graphql";
|
: "https://impress-2020.openneo.net/api/graphql";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue