diff options
Diffstat (limited to 'backend/ts/helpers.ts')
| -rw-r--r-- | backend/ts/helpers.ts | 18 |
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 |
