From 0fa6ceba586cd4ed7ec88059d4a76fdc6293e297 Mon Sep 17 00:00:00 2001 From: Chris <13677134+devcshort@users.noreply.github.com> Date: Wed, 8 Sep 2021 15:57:55 -0700 Subject: [PATCH] Use appconfig helper --- app.config.json | 5 ----- src/components/modules/Search/Search.tsx | 4 +++- src/redux/slices/location.ts | 5 ++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app.config.json b/app.config.json index f89d18a..f7f60d5 100644 --- a/app.config.json +++ b/app.config.json @@ -37,11 +37,6 @@ "lat": "47.751076", "lon": "-120.740135" } - }, - "places": { - "google": { - "apiKey": "" - } } }, "theme": { diff --git a/src/components/modules/Search/Search.tsx b/src/components/modules/Search/Search.tsx index 19f0a25..5f3a075 100644 --- a/src/components/modules/Search/Search.tsx +++ b/src/components/modules/Search/Search.tsx @@ -66,7 +66,9 @@ function Search({ variant = 'outlined' }: Props) { const lng = position.coords.longitude; fetch( - `https://maps.googleapis.com/maps/api/geocode/json?latlng=${lat},${lng}&sensor=false&key=${process.env.NEXT_PUBLIC_GOOGLE_API_KEY}`, + `https://maps.googleapis.com/maps/api/geocode/json?latlng=${lat},${lng}&sensor=false&key=${getAppConfigValue( + 'services.map.google.apiKey' + )}`, { method: 'POST', } diff --git a/src/redux/slices/location.ts b/src/redux/slices/location.ts index 2f7f033..2982ffe 100644 --- a/src/redux/slices/location.ts +++ b/src/redux/slices/location.ts @@ -1,6 +1,7 @@ import { createSlice, PayloadAction, createAsyncThunk } from '@reduxjs/toolkit'; import axios from 'axios'; import SessionStorage from '@service/sessionStorage'; +import { getAppConfigValue } from '@util/getAppConfigValue'; const initialState = { lat: null, @@ -37,7 +38,9 @@ export const fetchLocation = createAsyncThunk( } else { // Fetch the location if it's not found in cache const res = await CustomAxios.post( - `https://maps.googleapis.com/maps/api/geocode/json?address=${config.location}&sensor=false&key=${process.env.NEXT_PUBLIC_GOOGLE_API_KEY}` + `https://maps.googleapis.com/maps/api/geocode/json?address=${ + config.location + }&sensor=false&key=${getAppConfigValue('services.map.google.apiKey')}` ); payload = {