aboutsummaryrefslogtreecommitdiffstats
path: root/backend/ts/helpers.ts
blob: 984ce2debeb253dd02920387a6edf05ecb53dc95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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();
}