Update Types

This commit is contained in:
Benjamin Toby
2024-11-08 16:41:22 +01:00
parent 2ee812fef5
commit afd50caf42
7 changed files with 175 additions and 11 deletions
+38 -3
View File
@@ -1,4 +1,4 @@
import http from "http";
import type { IncomingMessage, ServerResponse } from "http";
import { Editor } from "tinymce";
export type DSQL_DatabaseFullName = string;
@@ -186,9 +186,9 @@ export interface PackageUserLoginLocalBody {
dbSchema?: DSQL_DatabaseSchemaType;
}
type Request = http.IncomingMessage;
type Request = IncomingMessage;
type Response = http.ServerResponse;
type Response = ServerResponse;
type ImageInputFileToBase64FunctionReturn = {
imageBase64: string;
@@ -1096,3 +1096,38 @@ export type CheckApiCredentialsFnParam = {
database?: string;
table?: string;
};
export type FetchApiFn = (
url: string,
options?: FetchApiOptions,
csrf?: boolean
) => Promise<any>;
type FetchApiOptions = {
method:
| "POST"
| "GET"
| "DELETE"
| "PUT"
| "PATCH"
| "post"
| "get"
| "delete"
| "put"
| "patch";
body?: object | string;
headers?: FetchHeader;
};
export type AuthCsrfHeaderName = "x-csrf-auth";
type FetchHeader = HeadersInit & {
[key in AuthCsrfHeaderName]?: string | null;
};
export type FetchApiReturn = {
success: boolean;
payload: any;
msg?: string;
[key: string]: any;
};