mirror of
https://github.com/ajnart/homarr.git
synced 2026-03-06 04:11:04 +01:00
Merge pull request #1519 from ajnart/feature/local-weather-fetch
✨ Fetch the weather using a local request instead of a server-side one
This commit is contained in:
@@ -36,20 +36,6 @@ export const weatherRouter = createTRPCRouter({
|
||||
})
|
||||
)
|
||||
.query(async ({ input }) => fetchCity(input.query)),
|
||||
at: publicProcedure
|
||||
.input(
|
||||
z.object({
|
||||
longitude: z.number(),
|
||||
latitude: z.number(),
|
||||
})
|
||||
)
|
||||
.output(weatherSchema)
|
||||
.query(async ({ input }) => {
|
||||
const res = await fetch(
|
||||
`https://api.open-meteo.com/v1/forecast?latitude=${input.latitude}&longitude=${input.longitude}&daily=weathercode,temperature_2m_max,temperature_2m_min¤t_weather=true&timezone=Europe%2FLondon`
|
||||
);
|
||||
return res.json();
|
||||
}),
|
||||
});
|
||||
|
||||
export type City = z.infer<typeof citySchema>;
|
||||
|
||||
Reference in New Issue
Block a user