39 lines
776 B
TypeScript
39 lines
776 B
TypeScript
import axios from "axios";
|
|
import {Api} from "~/utils/Api";
|
|
|
|
export class Account
|
|
{
|
|
static baseURL: "http://localhost:8089/api/iam-backend/realms/key/accounts";
|
|
|
|
firstname?: string;
|
|
lastname?: string;
|
|
username?: string;
|
|
email?: string;
|
|
password?: string;
|
|
roles?: string[];
|
|
initial?: boolean;
|
|
|
|
static get(onSuccess: (account: Account) => void)
|
|
{
|
|
|
|
}
|
|
|
|
static create(user: AccountCreation, onSuccess: () => void)
|
|
{
|
|
AuthApi.create().post('/accounts', user)
|
|
.then(() =>
|
|
{
|
|
onSuccess();
|
|
});
|
|
}
|
|
}
|
|
|
|
export class AccountCreation
|
|
{
|
|
firstname?: string;
|
|
lastname?: string;
|
|
email?: string;
|
|
password?: string;
|
|
username?: string;
|
|
role: string = "USER";
|
|
} |