From f09a607c8e5a45bc9ac97337fbd9ae88ecddaf33 Mon Sep 17 00:00:00 2001 From: Michal Bartosik Date: Wed, 22 Sep 2021 19:42:25 +0200 Subject: [PATCH] Update api endpoint and create env variable --- .gitignore | 1 + src/helpers/api.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a281131..b259c14 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ # misc .DS_Store +.env .env.local .env.development.local .env.test.local diff --git a/src/helpers/api.ts b/src/helpers/api.ts index 2a56035..a5f640b 100644 --- a/src/helpers/api.ts +++ b/src/helpers/api.ts @@ -1,7 +1,9 @@ import axios from 'axios'; import Country from 'models/Country'; -const baseUrl = 'https://restcountries.eu/rest/v2/all'; +const { REACT_APP_ACCESS_KEY } = process.env; + +const baseUrl = `https://api.countrylayer.com/v2/all?access_key=${REACT_APP_ACCESS_KEY}`; export const getCountries = async () => { const { data }: { data: Country[] } = await axios.get(baseUrl);