VirtWebRemote/remote_frontend/src/api/ServerApi.ts

31 lines
578 B
TypeScript
Raw Normal View History

import { APIClient } from "./ApiClient";
export interface ServerConfig {
authenticated: boolean;
disable_auth: boolean;
}
let config: ServerConfig | null = null;
export class ServerApi {
/**
* Get server configuration
*/
static async LoadConfig(): Promise<void> {
config = (
await APIClient.exec({
uri: "/server/config",
method: "GET",
})
).data;
}
/**
* Get cached configuration
*/
static get Config(): ServerConfig {
if (config === null) throw new Error("Missing configuration!");
return config;
}
}