This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/src/api/user.ts

27 lines
577 B
TypeScript
Raw Normal View History

2020-12-01 11:41:37 +00:00
import { DefaultClient, PBResponse } from "./client";
export class User {
pk: number;
username: string;
name: string;
is_superuser: boolean;
email: boolean;
avatar: string;
constructor() {
throw Error();
}
static me(): Promise<User> {
return DefaultClient.fetch<User>(["core", "users", "me"]);
}
2020-12-01 11:41:37 +00:00
static count(): Promise<number> {
return DefaultClient.fetch<PBResponse<User>>(["core", "users"], {
"page_size": 1
}).then(r => {
return r.pagination.count;
});
}
}