provide host

This commit is contained in:
Max Peintner
2025-01-15 15:39:18 +01:00
parent 4929740e9c
commit 6afdb98299
7 changed files with 137 additions and 47 deletions

View File

@@ -22,7 +22,12 @@ export type RegisterUserResponse = {
export async function inviteUser(command: InviteUserCommand) {
const host = (await headers()).get("host");
if (!host) {
return { error: "Could not get domain" };
}
const human = await addHumanUser({
host,
email: command.email,
firstName: command.firstName,
lastName: command.lastName,
@@ -34,7 +39,7 @@ export async function inviteUser(command: InviteUserCommand) {
return { error: "Could not create user" };
}
const codeResponse = await createInviteCode(human.userId, host);
const codeResponse = await createInviteCode({ userId: human.userId, host });
if (!codeResponse || !human) {
return { error: "Could not create invite code" };