mirror of
https://github.com/jorisbertomeu/web-screensaver.git
synced 2026-04-19 16:27:40 +02:00
Catch error on HA Collection retrieve
This commit is contained in:
@@ -18,6 +18,7 @@ export class PhotoController {
|
||||
let collections = settings.unsplash?.HACollectionsId;
|
||||
|
||||
if (collections && collections.length > 0) {
|
||||
try {
|
||||
const resp = await fetch(`${settings.hass.endpoint}/api/states/${collections}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${settings.hass.token}`
|
||||
@@ -28,6 +29,9 @@ export class PhotoController {
|
||||
if (collections.includes(',')) {
|
||||
collections = collections.split(',');
|
||||
}
|
||||
} catch(e) {
|
||||
collections = settings.unsplash.collectionsId;
|
||||
}
|
||||
} else {
|
||||
collections = settings.unsplash.collectionsId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user