const axios = require('axios').default;

async function divisionList(company,token){
  const response = await axios.get(process.env.backend_url+'/api/divisions'+(company=='All'?'':('?filters[companies][id][$in]='+company)),{
    headers: {'Authorization': `Bearer ${token}`}
  }).catch((e)=>{
    console.log(e.response.body);
  });
    return (response)?response.data.data:[];
}

module.exports = {divisionList};