aboutsummaryrefslogtreecommitdiffstats
path: root/backend/ts/helpers.ts
diff options
context:
space:
mode:
authorMaks Jopek <maksymilian.jopek@prym-soft.pl>2021-04-04 01:53:24 +0200
committerMaks Jopek <maksymilian.jopek@prym-soft.pl>2021-04-04 01:53:24 +0200
commit292257d627bd1dfeafd772ac6457e2f54c2b73ba (patch)
treeb7962648b87ab709e8529075ce912950019adaee /backend/ts/helpers.ts
parenteee4ee32dd667ed6efd31ddcf8f64217b7e16b60 (diff)
downloadfia-292257d627bd1dfeafd772ac6457e2f54c2b73ba.tar.gz
fia-292257d627bd1dfeafd772ac6457e2f54c2b73ba.tar.zst
fia-292257d627bd1dfeafd772ac6457e2f54c2b73ba.zip
One step closer to the end
Diffstat (limited to 'backend/ts/helpers.ts')
-rw-r--r--backend/ts/helpers.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/backend/ts/helpers.ts b/backend/ts/helpers.ts
new file mode 100644
index 0000000..984ce2d
--- /dev/null
+++ b/backend/ts/helpers.ts
@@ -0,0 +1,18 @@
+import fetch from "node-fetch";
+
+export async function makeQuery (query: string, params: Array<string>): Promise<string> {
+ return await (
+ await fetch("https://jopek.eu/maks/szkola/apkKli/fiaFiles/fia.php", {
+ method: "POST",
+ headers: {
+ Accept: "application/json",
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify({
+ apiKey: process.env.API_KEY,
+ stmt: query,
+ params: params
+ })
+ })
+ ).text();
+} \ No newline at end of file