From 2ca9cbb36e25e280a1b26c9dc03eaea30e1dcc9d Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 21 Mar 2020 15:20:41 +0300 Subject: refactor: improve requests.ts --- src/requests.ts | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/requests.ts') 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 => { - return axios.get( - baseApiUrl + url, - ); -}; +export const get = (url: string): Promise => axios.get(baseApiUrl + url); -export const post = (url: string, data: object): Promise => { - return axios.post( - baseApiUrl + url, - data - ); -}; +export const del = (url: string): Promise => axios.delete(baseApiUrl + url); + +export const post = (url: string, data: object): Promise => axios.post(baseApiUrl + url, data); -export const del = (url: string, data: object): Promise => { - return axios.delete( - baseApiUrl + url, - data - ) -}; -- cgit v1.2.3