Added basic accounts system and integration with new api calls
This commit is contained in:
parent
7df189c3b4
commit
10f347ea0c
5 changed files with 199 additions and 35 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import {Blog, 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');
|
||||
|
|
@ -18,4 +18,21 @@ export async function getBlogs(): Promise<Blog[]> {
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue