mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
30 lines
No EOL
1 KiB
JavaScript
30 lines
No EOL
1 KiB
JavaScript
import { graphql } from 'react-apollo';
|
|
import gql from 'graphql-tag';
|
|
import { getFragment, getFragmentName } from 'meteor/vulcan:core';
|
|
|
|
export default function withPaymentAction(options) {
|
|
|
|
const fragment = options.fragment || getFragment(options.fragmentName);
|
|
const fragmentName = getFragmentName(fragment) || fragmentName;
|
|
|
|
const mutation = gql`
|
|
mutation paymentActionMutation($token: JSON, $userId: String, $productKey: String, $associatedCollection: String, $associatedId: String, $properties: JSON, $coupon: String) {
|
|
paymentActionMutation(token: $token, userId: $userId, productKey: $productKey, associatedCollection: $associatedCollection, associatedId: $associatedId, properties: $properties, coupon: $coupon) {
|
|
__typename
|
|
...${fragmentName}
|
|
}
|
|
}
|
|
${fragment}
|
|
`;
|
|
|
|
return graphql(mutation, {
|
|
alias: 'withPaymentAction',
|
|
props: ({ownProps, mutate}) => ({
|
|
paymentActionMutation: (vars) => {
|
|
return mutate({
|
|
variables: vars,
|
|
});
|
|
}
|
|
}),
|
|
});
|
|
} |