diff --git a/src/components/AddIncome/AddIncome.js b/src/components/AddIncome/AddIncome.js index 3ada3d7a..6cf0de7f 100644 --- a/src/components/AddIncome/AddIncome.js +++ b/src/components/AddIncome/AddIncome.js @@ -40,7 +40,7 @@ const AddIncome = ({ totalIncome, setTotalIncome, setTransactions }) => { try { const { data } = await createIncome({ variables: { - userId, + userId, source, amount: amountCents, date, diff --git a/src/components/App/App.js b/src/components/App/App.js index 489537f0..d5ce3331 100644 --- a/src/components/App/App.js +++ b/src/components/App/App.js @@ -57,4 +57,4 @@ const App = () => { ) } -export default App; \ No newline at end of file +export default App; diff --git a/src/components/apollo-client/apollo-client.js b/src/components/apollo-client/apollo-client.js index 4742cd45..84c2d712 100644 --- a/src/components/apollo-client/apollo-client.js +++ b/src/components/apollo-client/apollo-client.js @@ -2,7 +2,8 @@ import { ApolloClient, InMemoryCache, createHttpLink } from "@apollo/client"; import { setContext } from "@apollo/client/link/context"; const httpLink = createHttpLink({ - uri: "https://doughfin-be.onrender.com/graphql", + // uri: "https://doughfin-be.onrender.com/graphql", + uri: "http://localhost:3000/graphql" }); const customHeaders = setContext((_, { headers }) => { diff --git a/src/components/apollo-client/mutations/createExpense.js b/src/components/apollo-client/mutations/createExpense.js index ae5f31c6..85152101 100644 --- a/src/components/apollo-client/mutations/createExpense.js +++ b/src/components/apollo-client/mutations/createExpense.js @@ -2,19 +2,22 @@ import { gql, useMutation } from "@apollo/client"; export const CREATE_EXPENSE = gql` mutation CreateExpense($userId: ID!, $vendor: String!, $category: String!, $amount: Float!, $date: String!) { - createExpense(input: { - userId: $userId, - vendor: $vendor, - category: $category, - amount: $amount, - date: $date - }) { - userId - vendor - category - amount - date - } + createExpense(input: { + userId: $userId, + vendor: $vendor, + category: $category, + amount: $amount, + date: $date + }) { + userId + expense { + id + vendor + category + amount + date + } + } }` export const useCreateExpense = () => { diff --git a/src/components/apollo-client/mutations/createIncome.js b/src/components/apollo-client/mutations/createIncome.js index 0ed44907..e818570f 100644 --- a/src/components/apollo-client/mutations/createIncome.js +++ b/src/components/apollo-client/mutations/createIncome.js @@ -2,17 +2,19 @@ import { gql, useMutation } from "@apollo/client"; export const CREATE_INCOME = gql` mutation CreateIncome($userId: ID!, $source: String!, $amount: Float!, $date: String!) { - createIncome(input: { - userId: $userId, - source: $source, - amount: $amount, - date: $date - }) { - userId - source - amount - date - } + createIncome(input: { + userId: $userId, + source: $source, + amount: $amount, + date: $date + }) { + userId + income { + source + amount + date + } + } }`; export const useCreateIncome = () => {