Login:Src:Utils: add ownerChange action

This commit is contained in:
Darya Umrikhina 2024-07-25 12:36:50 +04:00
parent 12d191c739
commit b5477a316e

View File

@ -381,3 +381,22 @@ export async function changePassword(
return user.response as TUser;
}
export async function ownerChange(
ownerId?: string,
confirmKey: string | null = null,
) {
const [changePassword] = createRequest(
[`/settings/owner`],
[
confirmKey ? ["confirm", confirmKey] : ["", ""],
["Content-Type", "application/json;charset=utf-8"],
],
"PUT",
JSON.stringify({ ownerId }),
);
const res = await fetch(changePassword);
if (!res.ok) throw new Error(res.statusText);
}