import axios from './config'; import { resolveResponse, handleError } from './serviceUtils'; class BaseService { static async get(url: string): Promise { return axios.get(url).then(resolveResponse).catch(handleError); } static async post(url: string, data: any): Promise { return axios .post(url, data ?? null) .then(resolveResponse) .catch(handleError); } static async put(url: string, data: any): Promise { return axios.put(url, data).then(resolveResponse).catch(handleError); } static async patch(url: string, data: any): Promise { return axios.patch(url, data).then(resolveResponse).catch(handleError); } static async delete(url: string): Promise { return axios.delete(url).then(resolveResponse).catch(handleError); } } export default BaseService;