From d8ae3495d9215b45c97dfa71cb2570c07a776a14 Mon Sep 17 00:00:00 2001 From: Chandra Galbiati Date: Fri, 23 Mar 2018 09:38:39 -0400 Subject: [PATCH] Proxy requests to api to avoid cors --- _redirects | 3 +++ src/gateways/locations.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 _redirects diff --git a/_redirects b/_redirects new file mode 100644 index 0000000..2da7a1c --- /dev/null +++ b/_redirects @@ -0,0 +1,3 @@ +# /_redirects + +/api/* https://takebackday.infoloom.com/:splat \ No newline at end of file diff --git a/src/gateways/locations.js b/src/gateways/locations.js index 0a7bdbe..d15221d 100644 --- a/src/gateways/locations.js +++ b/src/gateways/locations.js @@ -1,6 +1,7 @@ import mockData from '../mockData'; -const jsonEndpoint = 'https://takebackday.infoloom.com/media/output.json'; +// Actual host url is set in redirects file to avoid CORS +const jsonEndpoint = '/api/media/output.json'; export const fetchLocations = () => ( fetch(jsonEndpoint)