allow weather apis to use hidden api keys

This commit is contained in:
Ben Phelps 2022-09-05 20:14:14 +03:00
parent 08afa0b747
commit 5a8defb478
6 changed files with 61 additions and 12 deletions

View file

@ -4,9 +4,7 @@ import { BiError } from "react-icons/bi";
import Icon from "./icon";
export default function OpenWeatherMap({ options }) {
const { data, error } = useSWR(
`/api/widgets/openweathermap?lat=${options.latitude}&lon=${options.longitude}&apiKey=${options.apiKey}&duration=${options.cache}&units=${options.units}`
);
const { data, error } = useSWR(`/api/widgets/openweathermap?${new URLSearchParams(options).toString()}`);
if (error || data?.cod == 401) {
return (