diff options
author | eug-vs <eug-vs@keemail.me> | 2020-03-21 15:20:41 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-03-21 15:20:41 +0300 |
commit | 2ca9cbb36e25e280a1b26c9dc03eaea30e1dcc9d (patch) | |
tree | 53429fdf101d4ee0dc43e910fc41d2cc4502a198 /src | |
parent | ef3f55d8396218a41b48c4ed10a5e515ac320e5c (diff) | |
download | chrono-cube-ui-2ca9cbb36e25e280a1b26c9dc03eaea30e1dcc9d.tar.gz |
refactor: improve requests.ts
Diffstat (limited to 'src')
-rw-r--r-- | src/requests.ts | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/requests.ts b/src/requests.ts index 961d8d6..0242ed5 100644 --- a/src/requests.ts +++ b/src/requests.ts @@ -3,22 +3,9 @@ import axios, { AxiosResponse } from 'axios'; const baseUrl = 'https://eugvs.pythonanywhere.com/'; const baseApiUrl = baseUrl + 'api/'; -export const get = (url: string): Promise<AxiosResponse> => { - return axios.get( - baseApiUrl + url, - ); -}; +export const get = (url: string): Promise<AxiosResponse> => axios.get(baseApiUrl + url); -export const post = (url: string, data: object): Promise<AxiosResponse> => { - return axios.post( - baseApiUrl + url, - data - ); -}; +export const del = (url: string): Promise<AxiosResponse> => axios.delete(baseApiUrl + url); + +export const post = (url: string, data: object): Promise<AxiosResponse> => axios.post(baseApiUrl + url, data); -export const del = (url: string, data: object): Promise<AxiosResponse> => { - return axios.delete( - baseApiUrl + url, - data - ) -}; |