You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
776 B

4 years ago
/**
* @file Утилиты
* @version 2022.01.26
* @author Verevkin S.A.
* @copyright Verevkin S.A.
*/
import axios from 'axios';
const tool = {
apiUrl: process.env.REACT_APP_API_URL,
// region функции
// метод взаимодействия с REST-сервисом
get<TResult>(
method: string,
args: any,
): Promise<TResult | undefined> {
const url = this.apiUrl + method;
const requestConfig = {
params: Object
};
return axios
.get<TResult>(
`${url}`,
requestConfig,
)
.then((response) => {
const { data } = response;
return data;
})
.catch((err) => {
console.warn(err);
throw err;
4 years ago
});
},
//endregion
};
export default tool;