Fix crash when API returns error

This commit is contained in:
Max Goodhart
2020-06-23 23:42:31 -07:00
parent da93fba53f
commit 07feed0a91

View File

@@ -21,7 +21,7 @@ export async function* pollPublicData() {
const publicDataURL = 'https://woke.net/api/streams.json' const publicDataURL = 'https://woke.net/api/streams.json'
const refreshInterval = 5 * 1000 const refreshInterval = 5 * 1000
while (true) { while (true) {
let data let data = []
try { try {
const resp = await fetch(publicDataURL) const resp = await fetch(publicDataURL)
data = await resp.json() data = await resp.json()