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

Function geocode

src/components/SearchBar.tsx:35–49  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

33 return () => document.removeEventListener("mousedown", handleClickOutside);
34 }, []);
35
36 const geocode = async (text: string) => {
37 if (text.length < 2) {
38 setResults([]);
39 return;
40 }
41 try {
42 const { data } = await callBackend("mapbox-geocode", { mode: "forward", query: text, limit: 4 });
43 setResults(((data?.features as GeocodingResult[]) || []).slice(0, 4));
44 setShowResults(true);
45 } catch {
46 setResults([]);
47 }
48 };
49
50 const handleChange = (value: string) => {
51 setQuery(value);
52 onSearch(value);

Callers 1

handleChangeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected