mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-16 21:58:40 +00:00
343290a55a
* cleanup unnecessary mocks * refactor document storage location * remove unused function * move ownership to document types to repo package * move types and mappers to repo package * refactor sets to own package
34 lines
809 B
TypeScript
34 lines
809 B
TypeScript
import { BaseAPI, route } from "./base";
|
|
import { ApiSummary, TokenResponse, UserRegistration } from "./types/data-contracts";
|
|
|
|
export type LoginPayload = {
|
|
username: string;
|
|
password: string;
|
|
};
|
|
|
|
export type StatusResult = {
|
|
health: boolean;
|
|
versions: string[];
|
|
title: string;
|
|
message: string;
|
|
};
|
|
|
|
export class PublicApi extends BaseAPI {
|
|
public status() {
|
|
return this.http.get<ApiSummary>({ url: route("/status") });
|
|
}
|
|
|
|
public login(username: string, password: string) {
|
|
return this.http.post<LoginPayload, TokenResponse>({
|
|
url: route("/users/login"),
|
|
body: {
|
|
username,
|
|
password,
|
|
},
|
|
});
|
|
}
|
|
|
|
public register(body: UserRegistration) {
|
|
return this.http.post<UserRegistration, TokenResponse>({ url: route("/users/register"), body });
|
|
}
|
|
}
|