Login:Src:Utils: add new actions

This commit is contained in:
Darya Umrikhina 2024-08-07 13:51:21 +04:00
parent e4f733dbce
commit 2bfde3088c

View File

@ -100,15 +100,15 @@ export async function getVersionBuild() {
} }
export async function getColorTheme() { export async function getColorTheme() {
const [getSettings] = createRequest( const [getColorTheme] = createRequest(
[`/settings/colortheme`], [`/settings/colortheme`],
[["", ""]], [["", ""]],
"GET", "GET",
); );
const res = await fetch(getSettings); const res = await fetch(getColorTheme);
if (!res.ok) throw new Error(res.statusText); if (!res.ok) return;
const colorTheme = await res.json(); const colorTheme = await res.json();
@ -210,7 +210,7 @@ export async function getPortalCultures() {
const res = await fetch(getPortalCultures); const res = await fetch(getPortalCultures);
if (!res.ok) throw new Error(res.statusText); if (!res.ok) return;
const cultures = await res.json(); const cultures = await res.json();
@ -472,6 +472,21 @@ export async function suspendPortal(confirmKey: string | null = null) {
if (!res.ok) throw new Error(res.statusText); if (!res.ok) throw new Error(res.statusText);
} }
export async function continuePortal(confirmKey: string | null = null) {
const [continuePortal] = createRequest(
[`/portal/continue`],
[
confirmKey ? ["confirm", confirmKey] : ["", ""],
["Content-Type", "application/json;charset=utf-8"],
],
"PUT",
);
const res = await fetch(continuePortal);
if (!res.ok) throw new Error(res.statusText);
}
export async function changePassword( export async function changePassword(
passwordHash: string, passwordHash: string,
userId?: string, userId?: string,
@ -586,3 +601,22 @@ export async function deleteSelf(confirmKey: string | null = null) {
if (!res.ok) throw new Error(res.statusText); if (!res.ok) throw new Error(res.statusText);
} }
export async function deletePortal(confirmKey: string | null = null) {
const [deletePortal] = createRequest(
[`/portal/delete`],
[
confirmKey ? ["Confirm", confirmKey] : ["", ""],
["Accept", "application/json;charset=utf-8"],
],
"DELETE",
);
const res = await fetch(deletePortal);
if (!res.ok) throw new Error(res.statusText);
const feedbackUrl = await res.json();
return feedbackUrl.response as string;
}