MCPcopy Create free account
hub / github.com/Thanas-R/Virdis / geocode

Function geocode

src/components/LocationAutocomplete.tsx:32–43  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

30 return () => document.removeEventListener("mousedown", handleClickOutside);
31 }, []);
32
33 const geocode = async (text: string) => {
34 if (text.length < 2) { setResults([]); return; }
35 try {
36 const { data } = await callBackend("mapbox-geocode", { mode: "forward", query: text, limit: 4 });
37 setResults(data?.features || []);
38 setShowResults(true);
39 } catch {
40 setResults([]);
41 }
42 };
43
44 const handleChange = (val: string) => {
45 setQuery(val);
46 onChange(val);

Callers 1

handleChangeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected