Initial Commit
This commit is contained in:
14
frontend/src/js/utils.ts
Executable file
14
frontend/src/js/utils.ts
Executable file
@@ -0,0 +1,14 @@
|
||||
import { GeneralStats, Service } from "./models";
|
||||
|
||||
export async function getapi(path:string):Promise<any>{
|
||||
return await fetch(`/api/${path}`).then( res => res.json() )
|
||||
}
|
||||
|
||||
|
||||
export async function generalstats():Promise<GeneralStats>{
|
||||
return await getapi("general-stats") as GeneralStats;
|
||||
}
|
||||
|
||||
export async function servicelist():Promise<Service[]>{
|
||||
return await getapi("services") as Service[];
|
||||
}
|
||||
Reference in New Issue
Block a user