Fix IAM create

This commit is contained in:
Christian Torbidone 2024-08-12 11:44:15 +02:00
parent 174acabf43
commit 7aa011ebca

View file

@ -64,18 +64,22 @@ export class IAManager {
/** /**
* Asynchronously creates a new user in the IA API. * Asynchronously creates a new user in the IA API.
* *
* @param {string} username - The username of the user. * @param {string?} username - The username of the user.
* @param {string} password - The password of the user. * @param {string} password - The password of the user.
* @param {Identifier} identifier - The identifier of the user. * @param {Identifier} identifier - The identifier of the user. <type>:<value>
* @return {string} The ID of the newly created user. * @return {string} The ID of the newly created user.
*/ */
async create(username: string, password: string, identifier: Identifier) { async create(password: string, identifier: Identifier, username?: string) {
let req = await axios.post(`${this.URL}/IA}`, let psw: any = {
{
username,
password, password,
identifier identifier,
}); };
if (username) psw.username = username
let req = await axios.put(`${this.URL}/inav`,
psw
);
return req.data.id; return req.data.id;
} }
} }