service outages and use nws api
This commit is contained in:
parent
025e993700
commit
22129d5268
5 changed files with 126 additions and 60 deletions
14
src/nws-api/calls.ts
Normal file
14
src/nws-api/calls.ts
Normal 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;
|
||||
}
|
||||
|
34
src/nws-api/types.ts
Normal file
34
src/nws-api/types.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
export type UptimeRecord = {
|
||||
name: string,
|
||||
url: string,
|
||||
uptimeMonth: number,
|
||||
uptimeAllTime: number,
|
||||
isUp: boolean,
|
||||
undergoingMaintenance: boolean
|
||||
};
|
||||
|
||||
export type UptimeResponse = {
|
||||
datacenters: UptimeRecord[],
|
||||
services: UptimeRecord[]
|
||||
};
|
||||
|
||||
export type Blog = {
|
||||
id: number,
|
||||
title: string,
|
||||
author: string,
|
||||
content: string,
|
||||
imageUrl: string
|
||||
};
|
||||
|
||||
export type Incident = {
|
||||
id: number,
|
||||
severity: IncidentSeverity,
|
||||
title: string,
|
||||
description: string
|
||||
};
|
||||
|
||||
enum IncidentSeverity {
|
||||
LOW,
|
||||
MEDIUM,
|
||||
HIGH
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue