Update geocoding API calls to correctly parse JSON responses
Correctly parse the JSON response from the `/api/geocode` endpoint in the Sites page component by calling `.json()` on the response object. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e5565357-90e1-419f-b9a8-6ee8394636df Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/e5565357-90e1-419f-b9a8-6ee8394636df/HdlP8Fl
This commit is contained in:
parent
17b1969255
commit
e9f1c1e136
@ -144,11 +144,12 @@ export default function Sites() {
|
||||
|
||||
setIsGeocoding(true);
|
||||
try {
|
||||
const result: any = await apiRequest(
|
||||
const response = await apiRequest(
|
||||
"POST",
|
||||
"/api/geocode",
|
||||
{ address }
|
||||
);
|
||||
const result = await response.json();
|
||||
|
||||
form.setValue("latitude", result.latitude);
|
||||
form.setValue("longitude", result.longitude);
|
||||
@ -181,11 +182,12 @@ export default function Sites() {
|
||||
|
||||
setIsGeocodingEdit(true);
|
||||
try {
|
||||
const result: any = await apiRequest(
|
||||
const response = await apiRequest(
|
||||
"POST",
|
||||
"/api/geocode",
|
||||
{ address }
|
||||
);
|
||||
const result = await response.json();
|
||||
|
||||
editForm.setValue("latitude", result.latitude);
|
||||
editForm.setValue("longitude", result.longitude);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user