Handle no scheduled alarm case
This commit is contained in:
parent
764ac78063
commit
192e751405
2 changed files with 25 additions and 17 deletions
|
|
@ -65,7 +65,11 @@ export async function getAlarmSingle(aid) {
|
|||
export async function getNextAlarm() {
|
||||
const res = await fetch(`api/alarms/next`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
return new Date(await res.json());
|
||||
const data = await res.json();
|
||||
if (data)
|
||||
return new Date(data);
|
||||
else
|
||||
return data;
|
||||
} else {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue