import axios from 'axios'
import { useSelector } from 'react-redux'

import config from '../configs'
import { store } from '../redux/store'
export function getListProducts() {

    const token = store.getState().auth.token
    const body = {
        "drug_barcode": "",
        "drug_name": "",
        "company": "",
        "status": null,
        "quantity": 1,
        "exp_date": true
    }
    const header = {
        headers: {
            'Authorization': token
        }
    }
    const baseURL = config.axiosConfig().baseURL
    const url = `${baseURL}/inventory/product?page=1&size=10`
    return axios.post(url, body, header)
        .then(response => {
            let resJson = response.data
            return resJson
        })
        .catch(
            function (error) {
                console.log('Show error notification!')
                return Promise.reject(error)
            }
        )
}