error handling on wrong input in search bar
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Docker Build & Publish / Build Docker (push) Successful in 1m9s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Docker Build & Publish / Build Docker (push) Successful in 1m9s
				
			This commit is contained in:
		
							parent
							
								
									fcbb0b369a
								
							
						
					
					
						commit
						584176baff
					
				@ -10,6 +10,9 @@ export async function getLocation(searchLocation: string): Promise<coordType>{
 | 
				
			|||||||
      throw new Error(`There was an error fetching the data`);
 | 
					      throw new Error(`There was an error fetching the data`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const data: LocationType = await res.json();
 | 
					    const data: LocationType = await res.json();
 | 
				
			||||||
 | 
					    if (!data.results[0].formatted_address){
 | 
				
			||||||
 | 
					      throw new Error(`Unable to find the address`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      name: data.results[0].formatted_address,
 | 
					      name: data.results[0].formatted_address,
 | 
				
			||||||
      geo: data.results[0].geometry.location
 | 
					      geo: data.results[0].geometry.location
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ import { LocationContext } from "@/context/LocationContext";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export default function LocationSearch() {
 | 
					export default function LocationSearch() {
 | 
				
			||||||
  const [searchLocation, setSearchLocation] = useState("");
 | 
					  const [searchLocation, setSearchLocation] = useState("");
 | 
				
			||||||
  const { geoLocation, setGeoLocation } = useContext(LocationContext);
 | 
					  const { setGeoLocation } = useContext(LocationContext);
 | 
				
			||||||
  const [pending, setPending] = useState(false);
 | 
					  const [pending, setPending] = useState(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
 | 
					  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user