Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default async function (manager: Manager, settings: ComponentSettings) {
const response = await manager.fetch(
`https://wttr.in/${location}?format=j1`
)
const data = await response.json()
const data = response?.json() ?? null
const [summary] = data.current_condition
const { temp_C } = summary
return `<p>Temperature in ${location} is: ${temp_C} &#8451;</p>`
Expand All @@ -160,7 +160,7 @@ export default async function (manager: Manager, settings: ComponentSettings) {
const response = await manager.fetch(
`https://wttr.in/${location}?format=j1`
)
const data = await response.json()
const data = response?.json() ?? null
const [summary] = data.current_condition
const { temp_C } = summary
return `<p>Temperature in ${location} is: ${temp_C} &#8451;</p>`
Expand Down