From bbcc4214d3064d58cf59265db2da326c629232ff Mon Sep 17 00:00:00 2001 From: Eug-VS Date: Thu, 2 Jan 2020 13:05:18 +0300 Subject: Create functions for GET and POST requests --- src/requests.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/requests.js (limited to 'src/requests.js') diff --git a/src/requests.js b/src/requests.js new file mode 100644 index 0000000..91eaf65 --- /dev/null +++ b/src/requests.js @@ -0,0 +1,17 @@ +import axios from 'axios' + +const baseUrl = 'http://localhost:8000/'; +const baseApiUrl = baseUrl + 'api/'; + +export const get = (url) => { + return axios.get( + baseApiUrl + url, + ); +}; + +export const post = (url, data) => { + return axios.post( + baseApiUrl + url, + data + ); +}; -- cgit v1.2.3