@dpc-sdp/myvic-addresssearch
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -0,0 +0,0 @@ import { mount } from '@vue/test-utils' |
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.4.2](https://github.com/dpc-sdp/myvictoria-vic-gov-au/tree/master/packages/AddressSearch/compare/v1.4.0...v1.4.2) (2020-10-07) | ||
**Note:** Version bump only for package @dpc-sdp/myvic-addresssearch | ||
## [1.4.1](https://github.com/dpc-sdp/myvictoria-vic-gov-au/tree/master/packages/AddressSearch/compare/v1.4.0...v1.4.1) (2020-09-25) | ||
@@ -8,0 +16,0 @@ |
@@ -0,0 +0,0 @@ import AddressSearch from './index.vue' |
{ | ||
"name": "@dpc-sdp/myvic-addresssearch", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "An address search component for Victoria.", | ||
@@ -13,6 +13,6 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@dpc-sdp/myvic-autocomplete": "1.4.1", | ||
"@dpc-sdp/myvic-autocomplete": "1.4.2", | ||
"axios": "^0.19.2" | ||
}, | ||
"gitHead": "0e30b4c647e4238783318428b50867b365a9b44a" | ||
"gitHead": "3895f043c6625cbd56d41fd601d675c1ddcba49c" | ||
} |
@@ -0,0 +0,0 @@ # @dpc-sdp/myvic-addresssearch |
@@ -0,0 +0,0 @@ export const addressSearchTemplate = ` |
@@ -10,8 +10,10 @@ import axios from 'axios' | ||
const fetchData = async (request) => { | ||
const response = await axios.get(request) | ||
const VICMAP_ADDRESS_API = 'https://api.vic.gov.au:443/delwp/address/v1/suggestions?query=' | ||
const fetchData = async (request, headers) => { | ||
const response = await axios.get(request, headers) | ||
return response | ||
} | ||
export const getAddressSuggestions = async (provider, query, mapboxGeocoderParams) => { | ||
export const getAddressSuggestions = async (provider, query, mapboxGeocoderParams, vicmapAddressAPIKey) => { | ||
if (provider === 'DELWP') { | ||
@@ -35,2 +37,13 @@ const response = await fetchData(SUGGEST_REQUEST + encodeURIComponent(query)) | ||
return addresses | ||
} else if (provider === 'VicmapAddressAPI') { | ||
const response = await fetchData(VICMAP_ADDRESS_API + encodeURIComponent(query), { | ||
headers: { 'apiKey': vicmapAddressAPIKey } | ||
}) | ||
const addresses = response.data.suggestions.map(x => ( | ||
{ | ||
...x, | ||
name: capitalize(x.label) | ||
} | ||
)) | ||
return addresses | ||
} else { | ||
@@ -54,2 +67,11 @@ return [] | ||
} | ||
} else if (provider === 'VicmapAddressAPI') { | ||
return { | ||
...item, | ||
address: item.label, | ||
location: { | ||
x: item.longitude, | ||
y: item.latitude | ||
} | ||
} | ||
} else { | ||
@@ -56,0 +78,0 @@ return {} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25460
101
+ Added@dpc-sdp/myvic-autocomplete@1.4.2(transitive)
+ Added@dpc-sdp/myvic-global@1.4.2(transitive)
- Removed@dpc-sdp/myvic-autocomplete@1.4.1(transitive)
- Removed@dpc-sdp/myvic-global@1.4.1(transitive)