web: rewrite aggregate cards to separate components

This commit is contained in:
Jens Langhammer
2020-12-16 22:00:40 +01:00
parent 1179ba4ef2
commit 9e33b49d29
5 changed files with 128 additions and 67 deletions

View File

@ -1,9 +1,20 @@
import { DefaultClient, PBResponse, QueryArguments } from "./client";
export interface Policy {
export class Policy {
pk: string;
name: string;
[key: string]: unknown;
constructor() {
throw Error();
}
static get(pk: string): Promise<PolicyBinding> {
return DefaultClient.fetch<PolicyBinding>(["policies", "all", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<PolicyBinding>> {
return DefaultClient.fetch<PBResponse<PolicyBinding>>(["policies", "all"], filter);
}
}
export class PolicyBinding {

19
web/src/api/provider.ts Normal file
View File

@ -0,0 +1,19 @@
import { DefaultClient, PBResponse, QueryArguments } from "./client";
export class Provider {
pk: number;
name: string;
authorization_flow: string;
constructor() {
throw Error();
}
static get(slug: string): Promise<Provider> {
return DefaultClient.fetch<Provider>(["providers", "all", slug]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Provider>> {
return DefaultClient.fetch<PBResponse<Provider>>(["providers", "all"], filter);
}
}