Adds dynamic table with initial settings page

This commit is contained in:
Jamie Curnow
2021-07-26 00:14:00 +10:00
parent 1bb66c13d5
commit 5ec02d8cb0
9 changed files with 344 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
export * from "./createUser";
export * from "./getToken";
export * from "./getUser";
export * from "./models";
export * from "./refreshToken";
export * from "./requestHealth";
export * from "./requestSettings";
export * from "./responseTypes";

View File

@@ -0,0 +1,12 @@
export interface Sort {
field: string;
direction: "ASC" | "DESC";
}
export interface Setting {
id: number;
createdOn: number;
modifiedOn: number;
name: string;
value: any;
}

View File

@@ -1,7 +1,6 @@
import * as api from "./base";
import { HealthResponse } from "./responseTypes";
// Request function.
export async function requestHealth(
abortController?: AbortController,
): Promise<HealthResponse> {

View File

@@ -0,0 +1,16 @@
import * as api from "./base";
import { SettingsResponse } from "./responseTypes";
export async function requestSettings(
offset?: number,
abortController?: AbortController,
): Promise<SettingsResponse> {
const { result } = await api.get(
{
url: "settings",
params: { limit: 20, offset: offset || 0 },
},
abortController,
);
return result;
}

View File

@@ -1,3 +1,5 @@
import { Sort, Setting } from "./models";
export interface HealthResponse {
commit: string;
errorReporting: boolean;
@@ -31,3 +33,11 @@ export interface UserResponse {
isDisabled: boolean;
auth?: UserAuthResponse;
}
export interface SettingsResponse {
total: number;
offset: number;
limit: number;
sort: Sort[];
items: Setting[];
}