add mutations to exchange painel

This commit is contained in:
João Geonizeli
2021-08-15 23:30:53 -03:00
parent 0ccd01abfd
commit 19a08cd50e
29 changed files with 702 additions and 198 deletions

View File

@@ -0,0 +1,37 @@
import { graphql } from "babel-plugin-relay/macro";
import type { Environment } from "react-relay";
import { commitMutation } from "react-relay";
import type { createBuyCryptoOrderMutationVariables } from "./__generated__/createBuyCryptoOrderMutation.graphql";
export const commitCreateBuyCryptoOrderMutation = (
environment: Environment,
variables: createBuyCryptoOrderMutationVariables
) => {
return commitMutation(environment, {
mutation: graphql`
mutation createBuyCryptoOrderMutation(
$currencyId: ID!
$amountCents: Int!
) {
createBuyCryptoOrder(
input: {
order: { currencyId: $currencyId, amountCents: $amountCents }
}
) {
errors {
messages
}
order {
id
}
}
}
`,
variables: { ...variables },
onCompleted: (_response) => {
window.location.reload();
},
onError: (_error) => {},
});
};