Login:Src:Utils: change actions for Activations page
This commit is contained in:
parent
a6257054bd
commit
9644ace769
@ -504,7 +504,13 @@ export async function changePassword(
|
|||||||
|
|
||||||
const res = await fetch(changePassword);
|
const res = await fetch(changePassword);
|
||||||
|
|
||||||
if (!res.ok) throw new Error(res.statusText);
|
if (!res.ok) {
|
||||||
|
if (res.status === 500) {
|
||||||
|
const errorRes = await res.json();
|
||||||
|
throw new Error(errorRes.error.message);
|
||||||
|
}
|
||||||
|
throw new Error(res.statusText);
|
||||||
|
}
|
||||||
|
|
||||||
const user = await res.json();
|
const user = await res.json();
|
||||||
|
|
||||||
@ -555,6 +561,37 @@ export async function updateActivationStatus(
|
|||||||
if (!res.ok) throw new Error(res.statusText);
|
if (!res.ok) throw new Error(res.statusText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function updateUser(
|
||||||
|
id: string,
|
||||||
|
FirstName?: string,
|
||||||
|
LastName?: string,
|
||||||
|
) {
|
||||||
|
const [updateUser] = createRequest(
|
||||||
|
[`/people/${id}`],
|
||||||
|
[["Content-Type", "application/json;charset=utf-8"]],
|
||||||
|
"PUT",
|
||||||
|
JSON.stringify({ id, FirstName, LastName }),
|
||||||
|
);
|
||||||
|
|
||||||
|
const res = await fetch(updateUser);
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
if (res.status === 500) {
|
||||||
|
const errorRes = await res.json();
|
||||||
|
throw new Error(errorRes.error.message);
|
||||||
|
}
|
||||||
|
throw new Error(res.statusText);
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await res.json();
|
||||||
|
|
||||||
|
if (user && user.displayName) {
|
||||||
|
user.displayName = Encoder.htmlDecode(user.displayName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return user.response as TUser;
|
||||||
|
}
|
||||||
|
|
||||||
export async function ownerChange(
|
export async function ownerChange(
|
||||||
ownerId?: string,
|
ownerId?: string,
|
||||||
confirmKey: string | null = null,
|
confirmKey: string | null = null,
|
||||||
|
Loading…
Reference in New Issue
Block a user