Kalkuli/2018.2-Kalkuli_Front-End

View on GitHub
src/services/getAllReceipts.js

Summary

Maintainability
A
3 hrs
Test Coverage
import axios from 'axios'
import {config, baseURL} from './axiosConfig'

export default async (mockError) => {
  try{
    if(mockError) throw new Error('mockingError')
    const company_id = localStorage.getItem('company_id')
    const response = await axios.get(`${baseURL}/${company_id}/receipts`, config)
    return response.data.data.receipts
  }
  catch(err){
    return 'error'
  }
}