mirror of
				https://github.com/gethomepage/homepage.git
				synced 2025-11-04 03:27:02 -05:00 
			
		
		
		
	always attempt location fetch
if it fails, then we just fallback to user interaction
This commit is contained in:
		
							parent
							
								
									5c347d9427
								
							
						
					
					
						commit
						85bc078c46
					
				@ -96,6 +96,8 @@ export default function OpenWeatherMap({ options }) {
 | 
				
			|||||||
    );
 | 
					    );
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!requesting && !location) requestLocation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!location) {
 | 
					  if (!location) {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
      <button type="button" onClick={() => requestLocation()} className="flex flex-col justify-center">
 | 
					      <button type="button" onClick={() => requestLocation()} className="flex flex-col justify-center">
 | 
				
			||||||
 | 
				
			|||||||
@ -75,7 +75,7 @@ export default function WeatherApi({ options }) {
 | 
				
			|||||||
  const [location, setLocation] = useState(false);
 | 
					  const [location, setLocation] = useState(false);
 | 
				
			||||||
  const [requesting, setRequesting] = useState(false);
 | 
					  const [requesting, setRequesting] = useState(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (options.latitude && options.longitude) {
 | 
					  if (!location && options.latitude && options.longitude) {
 | 
				
			||||||
    setLocation({ latitude: options.latitude, longitude: options.longitude });
 | 
					    setLocation({ latitude: options.latitude, longitude: options.longitude });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -97,6 +97,8 @@ export default function WeatherApi({ options }) {
 | 
				
			|||||||
    );
 | 
					    );
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!requesting && !location) requestLocation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!location) {
 | 
					  if (!location) {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
      <button type="button" onClick={() => requestLocation()} className="flex flex-col justify-center">
 | 
					      <button type="button" onClick={() => requestLocation()} className="flex flex-col justify-center">
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user