Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Use appconfig helper
Browse files Browse the repository at this point in the history
  • Loading branch information
devcshort committed Sep 8, 2021
1 parent 426ab99 commit 0fa6ceb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 0 additions & 5 deletions app.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
"lat": "47.751076",
"lon": "-120.740135"
}
},
"places": {
"google": {
"apiKey": ""
}
}
},
"theme": {
Expand Down
4 changes: 3 additions & 1 deletion src/components/modules/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down
5 changes: 4 additions & 1 deletion src/redux/slices/location.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 0fa6ceb

Please sign in to comment.