Skip to content

Commit

Permalink
fix: fix language parameter of city request made to Google API
Browse files Browse the repository at this point in the history
  • Loading branch information
matheuspiment committed Oct 9, 2019
1 parent b6eca32 commit 62c5a63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/controllers/CityController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Yup from 'yup'
import axios from 'axios'
import map from 'lodash/map'

import { GoogleMapPrediction } from '../types'
import { GoogleMapsPrediction } from '../types'
import googleMapsConfig from '../config/googleMaps'

class CityController {
Expand All @@ -19,7 +19,7 @@ class CityController {
params: {
input: req.query.search,
types: '(cities)',
language: 'es_US',
language: 'en_US',
key: process.env.GOOGLE_MAPS_API_KEY
}
})
Expand All @@ -30,7 +30,7 @@ class CityController {

const normalizedCities = map(
response.data.predictions,
(prediction: GoogleMapPrediction) => prediction.description
(prediction: GoogleMapsPrediction) => prediction.description
)

return res.status(200).json({ cities: normalizedCities })
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export interface AuthRequest extends Request {
userId: string
}

export interface GoogleMapPrediction {
export interface GoogleMapsPrediction {
description: string
}

0 comments on commit 62c5a63

Please sign in to comment.