import { fetch } from 'utils' ; import { AxiosInstance } from 'axios' ; export default class BaseService { endpoint : string ; fetch : AxiosInstance ; constructor ( endpoint ) { this . endpoint = endpoint ; this . fetch = fetch ; } list = ( params ? ) : any => fetch . get ( this . endpoint , { params } ) ; add = ( body ? ) : any => fetch . post ( this . endpoint , body ) ; update = ( id ? , body ? ) : any => fetch . put ( `${ this . endpoint }/${ id }` , body ) ; get = ( id ? ) : any => fetch . get ( `${ this . endpoint }/${ id }` ) ; delete = ( id ? ) : any => fetch . delete ( `${ this . endpoint }/${ id }` ) ; }