summaryrefslogtreecommitdiffstats
path: root/typescript/src/getAjaxResponse.ts
diff options
context:
space:
mode:
Diffstat (limited to 'typescript/src/getAjaxResponse.ts')
-rw-r--r--typescript/src/getAjaxResponse.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/typescript/src/getAjaxResponse.ts b/typescript/src/getAjaxResponse.ts
new file mode 100644
index 0000000..1459114
--- /dev/null
+++ b/typescript/src/getAjaxResponse.ts
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: AGPL-3.0-or-later */
+
+import AjaxResponse from "./AjaxResponse.js";
+import type AjaxSettings from "./AjaxSettings.js";
+
+export default async (AjaxSettings: AjaxSettings): Promise<AjaxResponse> => {
+ try {
+ Object.freeze(AjaxSettings);
+
+ // npm i @types/jquery
+ return Object.freeze(await jQuery.ajax(AjaxSettings));
+ } catch (error) {
+ console.warn({ error });
+ return {};
+ }
+};