Skip to content

Commit

Permalink
Use Geo from Address in SellAppliance
Browse files Browse the repository at this point in the history
  • Loading branch information
dmohns committed Nov 20, 2024
1 parent e1984ce commit 87c07a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
19 changes: 2 additions & 17 deletions src/frontend/src/modules/Client/Appliances/SellApplianceModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ import { currency, notify } from "@/mixins"
import { ApplianceService } from "@/services/ApplianceService"
import { AssetPersonService } from "@/services/AssetPersonService"
import { DeviceService } from "@/services/DeviceService"
import { getGeoDataFromAddress } from "@/repositories/Client/OpenCageData"
import { mapGetters } from "vuex"
import Loader from "@/shared/Loader.vue"
Expand Down Expand Up @@ -580,22 +579,8 @@ export default {
const address = this.person.addresses.find(
(x) => x.id === this.selectedAddressId,
)
const addressStr =
address.street !== null
? `${address.street}, ${address.city.name}, ${this.settings.country}`
: `${address.city.name}, ${this.settings.country}`
try {
const results = await getGeoDataFromAddress(addressStr)
const result = results.reduce((prev, current) => {
if (address.street) {
return prev.confidence > current.confidence ? prev : current
}
return prev.confidence < current.confidence ? prev : current
})
return `${result.geometry.lat},${result.geometry.lng}`
} catch (e) {
return address.city.location.points
}
return address.geo?.points || address.city?.location?.points
},
getRate(index, rateCount, cost) {
if (index === parseInt(rateCount)) {
Expand Down
19 changes: 0 additions & 19 deletions src/frontend/src/repositories/Client/OpenCageData.js

This file was deleted.

0 comments on commit 87c07a7

Please sign in to comment.