File size: 615 Bytes
f5071ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import axios from "axios";
import { cartUserId } from "../urls";
import activeUser from "../components/custom_hooks/activeUser";
import jwtToken from "../components/custom_hooks/GetJwtToken";
const gettingItems = () => {
return async function (dispatch) {
try {
const { id } = await activeUser();
let url = cartUserId(id);
const res = await axios.get(url, {
headers: {
token: jwtToken(),
},
});
dispatch({ type: "GETITEM", res });
} catch (e) {
// console.log(e.response);
dispatch({
type: "NOTFOUNDITEM",
msg: e.message,
});
}
};
};
export { gettingItems };
|