Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.3 kB
9
Indexable
Never
import axios from "axios";
import { useEffect, useState } from "react";
import { BtnLeftArrow } from "../../components/buttons/BtnLeftArrow/BtnLeftArrow";
import { BtnMedieval } from "../../components/buttons/BtnMedieval/BtnMedieval";
import { NavLinkLightUp } from "../../components/links/NavLinkLightUp/NavLinkLightUp";
import { access_token } from "../../utils/constants";
export default function Home() {
	const [data, setData] = useState([]);
	const [error, setError] = useState(false);
	const [loading, setLoading] = useState(true);

	useEffect(() => {
		const getItems = async () => {
			try {
				const itemsUrl =
					"https://us.api.blizzard.com/data/wow/search/item?namespace=static-us&name.en_US=sword&orderby=id&_page=1";
				const response = await axios.get(`${itemsUrl}${access_token}`);
				setData(response);
				setLoading(false);
			} catch (err) {
				setLoading(false);
				setError(true);
				console.log(err);
			}
		};

		getItems();
	}, []);

	return (
		<div>
			<div
				onClick={() => {
					console.log(data);
				}}
			>
				Test Div
			</div>
			<BtnMedieval text="Enter Moonkin" />
			<NavLinkLightUp text="Some Link Goes Here" />
			<BtnLeftArrow />
			<div>Test Div</div>
		</div>
	);
}