Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed mutiations to match Postman E2E contracts #18

Merged
merged 3 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/AddIncome/AddIncome.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const AddIncome = ({ totalIncome, setTotalIncome, setTransactions }) => {
try {
const { data } = await createIncome({
variables: {
userId,
userId,
source,
amount: amountCents,
date,
Expand Down
2 changes: 1 addition & 1 deletion src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ const App = () => {
)
}

export default App;
export default App;
3 changes: 2 additions & 1 deletion src/components/apollo-client/apollo-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
29 changes: 16 additions & 13 deletions src/components/apollo-client/mutations/createExpense.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subtle change

id
vendor
category
amount
date
}
}
}`

export const useCreateExpense = () => {
Expand Down
24 changes: 13 additions & 11 deletions src/components/apollo-client/mutations/createIncome.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
Loading