diff --git a/.env.example b/.env.example index 56cb7d4..f1fc489 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,2 @@ GATSBY_GITHUB_TOKEN=xxx -GATSBY_TYPEKIT_ID=xxx -NOMADLIST_PROFILE=xxx -NOMADLIST_KEY=xxx \ No newline at end of file +GATSBY_TYPEKIT_ID=xxx \ No newline at end of file diff --git a/README.md b/README.md index 7abfa1a..c1214c1 100644 --- a/README.md +++ b/README.md @@ -76,13 +76,13 @@ If you want to know how, have a look at the respective components: On client-side, my current and, if known, my next physical location on a city level is fetched from my (private) [nomadlist.com](https://nomadlist.com) profile and displayed in the header. -Fetching is split up into a serverless function, a hook, and display component. Fetching is done with a serverless function as to not expose the whole profile response into the browser. Requires `NOMADLIST_PROFILE` & `NOMADLIST_KEY` environment variables. +Fetching is split up into a serverless function, a hook, and display component. Fetching is done with a serverless function as to not expose the whole profile response into the browser. If you want to know how, have a look at the respective components: -- [`api/location.js`](api/location.js) - [`src/hooks/useLocation.js`](src/hooks/useLocation.js) - [`src/components/molecules/Location.jsx`](src/components/molecules/Location.jsx) +- [kremalicious/location](https://github.com/kremalicious/location) ### 💅 Theme switcher diff --git a/api/location.js b/api/location.js deleted file mode 100644 index fdcf118..0000000 --- a/api/location.js +++ /dev/null @@ -1,15 +0,0 @@ -import axios from 'axios' - -export default async function getLocationHandler(req, res) { - if (!process.env.NOMADLIST_PROFILE) return - - try { - const response = await axios( - `https://nomadlist.com/@${process.env.NOMADLIST_PROFILE}.json?key=${process.env.NOMADLIST_KEY}` - ) - if (!response?.data) return - res.json(response.data.location) - } catch (error) { - res.status(500).send(error) - } -} diff --git a/src/api b/src/api deleted file mode 120000 index 8edbb42..0000000 --- a/src/api +++ /dev/null @@ -1 +0,0 @@ -../api \ No newline at end of file diff --git a/src/components/molecules/Location.jsx b/src/components/molecules/Location.jsx index 0403ffa..761d5ec 100644 --- a/src/components/molecules/Location.jsx +++ b/src/components/molecules/Location.jsx @@ -37,7 +37,7 @@ export default function Location({ hide }) { const isDifferentCountry = now?.country !== next?.country const relativeTime = new RelativeTime({ locale: 'en' }) - return !hide && now ? ( + return !hide && now?.city ? ( { useEffect(() => { async function fetchData() { try { - const response = await axios(`/api/location`) + const response = await axios('https://location.kremalicious.com') if (!response) return setLocation(response.data) } catch (error) {