move
This commit is contained in:
1 parent
9a08bfbf44
commit
cfb96f03c0
6 files changed
+675
-246
No files matched your search
+10
-6
@@ -159,6 +159,10 @@ async function request<T>(url: string, options: ApiRequestInit = {}): Promise<T>
|
||||
return response.json() as Promise<T>;
|
||||
}
|
||||
|
||||
async function requestRestoreEndpoint<T>(path: string, options: ApiRequestInit) {
|
||||
return request<T>(path, options);
|
||||
}
|
||||
|
||||
export function login(payload: { username: string; password: string }) {
|
||||
return request<{ user: AuthUser }>("/api/auth/login", {
|
||||
method: "POST",
|
||||
@@ -225,7 +229,7 @@ export function createSetupAdmin(payload: { username: string; displayName: strin
|
||||
}
|
||||
|
||||
export function restoreSetupBackup(sql: string) {
|
||||
return request<{ ok: boolean }>("/api/setup/restore", {
|
||||
return requestRestoreEndpoint<{ ok: boolean }>("/api/setup/restore", {
|
||||
method: "POST",
|
||||
timeoutMs: 10 * 60 * 1000,
|
||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||
@@ -234,9 +238,9 @@ export function restoreSetupBackup(sql: string) {
|
||||
}
|
||||
|
||||
export function validateSetupBackup(sql: string) {
|
||||
return request<RestoreValidationResult>("/api/setup/restore/validate", {
|
||||
return requestRestoreEndpoint<RestoreValidationResult>("/api/setup/restore/validate", {
|
||||
method: "POST",
|
||||
timeoutMs: 10 * 60 * 1000,
|
||||
timeoutMs: 60_000,
|
||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||
body: sql
|
||||
});
|
||||
@@ -293,7 +297,7 @@ export async function downloadDatabaseExport() {
|
||||
}
|
||||
|
||||
export function restoreDatabaseBackup(sql: string) {
|
||||
return request<{ ok: boolean }>("/api/admin/restore/database", {
|
||||
return requestRestoreEndpoint<{ ok: boolean }>("/api/admin/restore/database", {
|
||||
method: "POST",
|
||||
timeoutMs: 10 * 60 * 1000,
|
||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||
@@ -302,9 +306,9 @@ export function restoreDatabaseBackup(sql: string) {
|
||||
}
|
||||
|
||||
export function validateDatabaseBackup(sql: string) {
|
||||
return request<RestoreValidationResult>("/api/admin/restore/database/validate", {
|
||||
return requestRestoreEndpoint<RestoreValidationResult>("/api/admin/restore/database/validate", {
|
||||
method: "POST",
|
||||
timeoutMs: 10 * 60 * 1000,
|
||||
timeoutMs: 60_000,
|
||||
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
||||
body: sql
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user