web: sort components into folders, implement pagination for table

This commit is contained in:
Jens Langhammer
2020-11-29 22:14:48 +01:00
parent 606e32603e
commit f7022dd11f
17 changed files with 213 additions and 109 deletions

View File

@ -14,7 +14,7 @@ export class Client {
return builtUrl;
}
fetch<T>(url: string[], query?: { [key: string]: string }): Promise<T> {
fetch<T>(url: string[], query?: { [key: string]: any }): Promise<T> {
const finalUrl = this.makeUrl(url, query);
return fetch(finalUrl)
.then((r) => {
@ -35,9 +35,20 @@ export class Client {
export const DefaultClient = new Client();
export interface PBResponse {
export interface PBPagination {
next?: number;
previous?: number;
count: number;
next: string;
previous: string;
current: number;
total_pages: number;
start_index: number;
end_index: number;
}
export interface PBResponse {
pagination: PBPagination;
results: Array<any>;
}

View File

@ -12,19 +12,18 @@ export class Config {
error_reporting_send_pii?: boolean;
static get(): Promise<Config> {
return DefaultClient.fetch<Config>(["root", "config"])
.then((config) => {
if (config.error_reporting_enabled) {
Sentry.init({
dsn: "https://33cdbcb23f8b436dbe0ee06847410b67@sentry.beryju.org/3",
release: `passbook@${VERSION}`,
integrations: [new Integrations.BrowserTracing()],
tracesSampleRate: 1.0,
environment: config.error_reporting_environment,
});
console.debug(`passbook/config: Sentry enabled.`);
}
return config;
});
return DefaultClient.fetch<Config>(["root", "config"]).then((config) => {
if (config.error_reporting_enabled) {
Sentry.init({
dsn: "https://33cdbcb23f8b436dbe0ee06847410b67@sentry.beryju.org/3",
release: `passbook@${VERSION}`,
integrations: [new Integrations.BrowserTracing()],
tracesSampleRate: 1.0,
environment: config.error_reporting_environment,
});
console.debug(`passbook/config: Sentry enabled.`);
}
return config;
});
}
}