web: port library page to clientside, router performance improvements

This commit is contained in:
Jens Langhammer
2020-11-30 12:33:09 +01:00
parent 775d80de6d
commit 1193608631
14 changed files with 287 additions and 387 deletions

View File

@ -1,4 +1,4 @@
import { DefaultClient } from "./client";
import { DefaultClient, PBResponse } from "./client";
export class Application {
pk?: string;
@ -6,6 +6,7 @@ export class Application {
slug?: string;
provider?: number;
launch_url?: string;
meta_launch_url?: string;
meta_icon?: string;
meta_description?: string;
@ -15,4 +16,8 @@ export class Application {
static get(slug: string): Promise<Application> {
return DefaultClient.fetch<Application>(["core", "applications", slug]);
}
static list(filter?: { [key: string]: string }): Promise<PBResponse<Application>> {
return DefaultClient.fetch<PBResponse<Application>>(["core", "applications"], filter);
}
}

View File

@ -47,8 +47,8 @@ export interface PBPagination {
end_index: number;
}
export interface PBResponse {
export interface PBResponse<T> {
pagination: PBPagination;
results: Array<any>;
results: Array<T>;
}