This commit is contained in:
Stanislaw-Golebiewski 2020-01-13 17:20:51 +01:00
parent 73d29e20da
commit 4fa45a2f09

View File

@ -9,6 +9,8 @@ import {
} from "semantic-ui-react";
import axios from "axios";
import useGlobal from "../../../../utils/global_state";
function ReceiptEntery(props) {
// console.log(
// props.activeIndex,
@ -49,6 +51,8 @@ function Receipts() {
const [receiptsLoaded, setReceiptsLoaded] = useState(false);
const [page, setPage] = useState(1);
const [activeIndex, setActiveIndex] = useState(-1);
const [globalState, globalActions] = useGlobal();
console.log("TOKEN: ", globalState.auth_token);
const handleClick = (oldIndex, index) => {
console.log(oldIndex, index);
@ -60,7 +64,9 @@ function Receipts() {
useEffect(() => {
console.log("Fetch data...");
axios
.get("/api/receipts/")
.get("/api/receipts/", {
headers: { Authorization: `Token ${globalState.auth_token}` }
})
.then(resp => {
setTimeout(() => {
console.log(resp.data.results);