service outages and use nws api

This commit is contained in:
Nicholas Orlowsky 2022-10-22 16:21:03 -05:00
parent 025e993700
commit 22129d5268
No known key found for this signature in database
GPG key ID: 3845F78A73B14100
5 changed files with 126 additions and 60 deletions

14
src/nws-api/calls.ts Normal file
View file

@ -0,0 +1,14 @@
import {Incident, UptimeResponse} from "./types";
export async function getUptime(): Promise<UptimeResponse> {
let response: Response = await fetch('https://api-nws.nickorlow.com/uptime');
let uptime: UptimeResponse = await response.json();
return uptime;
}
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;
}