Admin: Basic node listing

This commit is contained in:
baldo 2022-05-26 13:58:01 +02:00
commit 0f60436b2c
11 changed files with 223 additions and 58 deletions
frontend/src/utils

View file

@ -1,3 +1,5 @@
import type {TypeGuard} from "@/types/shared";
class Api {
private baseURL: string = import.meta.env.BASE_URL;
private apiPrefix = "api/";
@ -12,7 +14,7 @@ class Api {
return this.baseURL + this.apiPrefix + path;
}
async get<T>(path: string, isT: (arg: unknown) => arg is T): Promise<T> {
async get<T>(path: string, isT: TypeGuard<T>): Promise<T> {
const url = this.toURL(path);
const result = await fetch(url);
const json = await result.json();