prod's registration fixes
This commit is contained in:
parent
e1d917bcab
commit
10767e379c
1 changed files with 6 additions and 2 deletions
|
|
@ -166,6 +166,7 @@ export async function createSettingsItem(
|
||||||
payload: any,
|
payload: any,
|
||||||
bearer: string
|
bearer: string
|
||||||
): Promise<{ data: { id: string } }> {
|
): Promise<{ data: { id: string } }> {
|
||||||
|
// Note: callers are already using { data: ... } patterns when needed.
|
||||||
return dxPOST<{ data: { id: string } }>(`/items/${collection}`, bearer, payload);
|
return dxPOST<{ data: { id: string } }>(`/items/${collection}`, bearer, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,7 +212,8 @@ export async function createDirectusUser(input: {
|
||||||
? input.email.trim()
|
? input.email.trim()
|
||||||
: `${input.username}@noemail.local`;
|
: `${input.username}@noemail.local`;
|
||||||
|
|
||||||
const res = await directusAdminFetch<{ data: { id: string } }>(`/users`, {
|
// System endpoint `/users` expects raw fields (no { data } wrapper).
|
||||||
|
const res = await directusAdminFetch<{ data?: { id?: string } }>(`/users`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
@ -223,7 +225,9 @@ export async function createDirectusUser(input: {
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
return { id: String(res?.data?.id) };
|
const id = res?.data?.id as string | undefined;
|
||||||
|
if (!id) throw new Error("User create succeeded but no id returned");
|
||||||
|
return { id: String(id) };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function emailForUsername(username: string): Promise<string | null> {
|
export async function emailForUsername(username: string): Promise<string | null> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue