Skip to content

Commit c40e58c

Browse files
committed
Update front end to fetch data from netlify functions
1 parent 8974fb2 commit c40e58c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/components/home.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ function Home(props) {
1515
{loading ? <div>Loading Data from backend</div> : null}
1616
{error ? <div>Error loading data</div> : null}
1717

18-
{data && data.rates && data.rates.map((r, i) => (
18+
{data && data.resources && data.resources.map((r, i) => (
1919
<div key={i}>
20-
{r.currency} : {r.rate}USD$
20+
{r.title} : {r.description}
2121
</div>
2222
))}
2323
</header>

src/queries/foo.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { gql } from 'apollo-boost';
33

44
export const EXCHANGE_RATES = gql`
55
{
6-
rates(currency: "USD") {
7-
currency
8-
rate
6+
resources {
7+
title
8+
description
99
}
1010
}
1111
`;

src/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ApolloProvider } from "@apollo/react-hooks";
66

77
// TODO: Move uri value to config file
88
const client = new ApolloClient({
9-
uri: "https://48p1r2roz4.sse.codesandbox.io"
9+
uri: "https://hardcore-haibt-da9a6b.netlify.com/.netlify/functions/graphql"
1010
});
1111

1212
const Routes = () => {

0 commit comments

Comments
 (0)