Update calls.ts
This commit is contained in:
parent
8456552f5a
commit
3a62d327ad
|
@ -8,7 +8,12 @@ export async function getUptime(): Promise<UptimeResponse> {
|
|||
|
||||
export async function getIncidents(): Promise<Incident[]> {
|
||||
let response: Response = await fetch('https://api-nws.nickorlow.com/incidents');
|
||||
let incidents: Incident[] = await response.json();
|
||||
return incidents;
|
||||
try {
|
||||
let incidents: Incident[] = await response.json();
|
||||
if(incidents === null || incidents === undefined) return [];
|
||||
return incidents;
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue