const addItemToBasket = (item) => {
dispatch({type: ADD_ITEM_TO_BASKET, payload: item})
console.log(item.id, store.get('email'))
axios.defaults.xsrfCookieName = 'csrftoken'
axios.defaults.xsrfHeaderName = 'X-CSRFToken'
axios.post("http://localhost:8000/cart/add", {
uid: item.id, amount: 1, email: store.get('email')
})
.then((response) => {
console.log(response.data)
})
.catch((error) => {
console.log(error);
});
}
const addItemToBasket = (item) => {
dispatch({ type: ADD_ITEM_TO_BASKET, payload: item })
const data = { uid: item.id, amount: 1, email: store.get('email') }
const options = {
method: 'POST',
url: "http://localhost:8000/cart/add",
data: qs.stringify(data)
}
axios(options)
.then((response) => {
console.log(response.data)
})
.catch((error) => {
console.log(error);
});