aboutsummaryrefslogtreecommitdiff
path: root/src/requests.ts
diff options
context:
space:
mode:
authorilyayudovin <46264063+ilyayudovin@users.noreply.github.com>2020-06-11 04:25:24 +0300
committerGitHub <noreply@github.com>2020-06-11 04:25:24 +0300
commitf0f192e09993eedc2c9596bcdb520a96f5cfacdb (patch)
treeb94e8c0841521a50628574899f9a7ad5f5c7cf0c /src/requests.ts
parent9473f8836bc65d1e0ea87607def54b86d719bbc8 (diff)
parentb85725ec0fd5088a619a20d2a6370b1f4a38cc22 (diff)
downloadwhich-ui-f0f192e09993eedc2c9596bcdb520a96f5cfacdb.tar.gz
Merge pull request #24 from ilyayudovin/requests
Configure requests and integrate Feed component
Diffstat (limited to 'src/requests.ts')
-rw-r--r--src/requests.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/requests.ts b/src/requests.ts
new file mode 100644
index 0000000..486502d
--- /dev/null
+++ b/src/requests.ts
@@ -0,0 +1,10 @@
+import axios, { AxiosResponse } from 'axios';
+
+type Request = (url: string, data?: Record<string, unknown>) => Promise<AxiosResponse>;
+
+const baseApiUrl = 'http://localhost:3030';
+
+export const get: Request = url => axios.get(baseApiUrl + url);
+export const del: Request = url => axios.delete(baseApiUrl + url);
+export const post: Request = (url, data) => axios.post(baseApiUrl + url, data);
+