Remove direct calls to stadia API from geocoding

This commit is contained in:
Eli Ribble 2026-04-06 16:54:48 +00:00
parent 43dce16fbd
commit 9ef6aaa406
No known key found for this signature in database
20 changed files with 213 additions and 274 deletions

View file

@ -1,7 +1,6 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import type { Geocode } from "@/type/stadia";
import type { Location } from "@/types";
import type { Geocode, Location } from "@/type/api";
export const useGeocodeStore = defineStore("geocode", () => {
// State
@ -13,8 +12,16 @@ export const useGeocodeStore = defineStore("geocode", () => {
loading.value = true;
error.value = null;
try {
const url = `https://api.stadiamaps.com/geocoding/v2/reverse?point.lat=${location.lat}&point.lon=${location.lng}`;
const response = await fetch(url);
//const url = `https://api.stadiamaps.com/geocoding/v2/reverse?point.lat=${location.lat}&point.lon=${location.lng}`;
const url = "/api/geocode/reverse";
const response = await fetch(url, {
body: JSON.stringify(location),
method: "POST",
headers: {
"Content-Type": "application/json",
},
});
const data = (await response.json()) as Geocode;
return data;
} catch (err) {