Tell the user when they don't give us an address

Issue: #25
This commit is contained in:
Eli Ribble 2026-05-24 21:27:16 +00:00
parent 34f4980ad5
commit f4756637d6
No known key found for this signature in database
5 changed files with 67 additions and 48 deletions

View file

@ -477,6 +477,7 @@ import { useStoreLocal } from "@/store/local";
import { useStorePublicReport } from "@/store/publicreport";
import type { Marker } from "@/types";
import {
type APIError,
type Geocode,
type GeocodeSuggestion,
type PublicReport,
@ -535,7 +536,16 @@ async function doSubmit() {
// Don't set Content-Type, the browser should do it
});
if (!resp.ok) {
errorMessage.value = "Something went wrong. Your request could not be completed. Please try again.";
if (resp.status == 400) {
const data: APIError = (await resp.json()) as APIError;
if (data.message == "empty-address") {
errorMessage.value =
"You must provide either an address, or a location on the map, otherwise we don't have much to work with.";
}
} else {
errorMessage.value =
"Something went wrong. Your request could not be completed. Please try again.";
}
return;
}
const data: PublicReport = (await resp.json()) as PublicReport;