There was an error while loading. Please reload this page.
1 parent fbf2a89 commit a25a10fCopy full SHA for a25a10f
1 file changed
src/routes/home/Home.js
@@ -3,6 +3,26 @@ import { EventSeat } from "@material-ui/icons";
3
import "./Home.css";
4
5
class Home extends Component {
6
+ componentDidMount() {
7
+ return fetch("https://alpaca-backend.herokuapp.com/get-stocks", {
8
+ method: "GET",
9
+ headers: {
10
+ Accept: "application/json",
11
+ "Content-Type": "application/json"
12
+ }
13
+ })
14
+ .then(async response => {
15
+ console.log("res", response);
16
+ const data = await response.json();
17
+ console.log("result is", JSON.stringify(data));
18
+ return data;
19
20
+ .catch(err => {
21
+ console.log("API call error:", err);
22
+ return err;
23
+ });
24
25
+
26
render() {
27
return (
28
<div className="homeContainer">
0 commit comments