import { AxiosResponse } from 'axios' ; export const API = 'api' ; export const parseList = < T > ( response ) => { if ( ! response || ! response ?. status ) { return [ ] ; } if ( response ?. status !== 200 ) throw Error ( `Error, status ${ response ?. status }` ) ; let list = response . data ; if ( typeof list !== 'object' ) { list = [ ] ; } return list ; } ; export const parseItem = < T > ( response , code ) => { if ( response . status !== code ) throw Error ( `Error, status ${ response . status }` ) ; let item = response . data ; if ( typeof item !== 'object' ) { item = undefined ; } return item as T ; } ;