homebox/frontend/lib/api/classes/users.ts
Hayden b77c9be36f
chore: bump deps (#810)
* bump prettier/eslint-plugin

* bump nuxt pwa

* use typed imports

* set vue version to fix layout errors

* disable import
2024-03-01 09:08:14 -09:00

27 lines
737 B
TypeScript

import { BaseAPI, route } from "../base";
import type { ChangePassword, UserOut } from "../types/data-contracts";
import type { Result } from "../types/non-generated";
export class UserApi extends BaseAPI {
public self() {
return this.http.get<Result<UserOut>>({ url: route("/users/self") });
}
public logout() {
return this.http.post<object, void>({ url: route("/users/logout") });
}
public delete() {
return this.http.delete<void>({ url: route("/users/self") });
}
public changePassword(current: string, newPassword: string) {
return this.http.put<ChangePassword, void>({
url: route("/users/self/change-password"),
body: {
current,
new: newPassword,
},
});
}
}