This commit is contained in:
Nicholas Orlowsky 2023-01-07 11:29:58 -06:00
commit ddb20ee17c
No known key found for this signature in database
GPG key ID: 3845F78A73B14100
23 changed files with 2498 additions and 170 deletions

View file

@ -1,4 +1,4 @@
import {Incident, UptimeResponse} from "./types";
import {Blog, Incident, Service, SessionKey, UptimeResponse} from "./types";
export async function getUptime(): Promise<UptimeResponse> {
let response: Response = await fetch('https://api-nws.nickorlow.com/uptime');
@ -17,3 +17,27 @@ export async function getIncidents(): Promise<Incident[]> {
}
}
export async function getBlogs(): Promise<Blog[]> {
let response: Response = await fetch('https://api-nws.nickorlow.com/blogs');
let blogs: Blog[] = await response.json();
return blogs;
}
export async function getSessionKey(accountId: string, password: string): Promise<SessionKey> {
let response: Response = await fetch('https://api-nws.nickorlow.com/Account/session',
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'id': accountId,
'password': password
})
});
let sessionKey: SessionKey = await response.json();
return sessionKey;
}