Skip to content

Instantly share code, notes, and snippets.

@SachaG
SachaG / stuff.md
Last active September 13, 2017 13:49
Vulcan Forum Example Testing

Accounts

  • Create new account

Posts

  • Upvote a post
  • Downvote a post
# Front-End
preact
mithril
inferno
elm
skate
cycle
avalon
sencha
React
Angular
"Angular 2"
Ember
Vue
Backbone
Polymer
Aurelia
"No Front-End Framework"
"Other Front-End Frameworks"

Vulcan Charge

This package helps you process charges with Vulcan. It currently only supports Stripe, but other payment processors may be supported in the future (PRs welcome!).

Overview

This package does the following things:

  • Provide a button that triggers the Stripe Checkout form.
  • Once the form is submitted, trigger a GraphQL mutation that will perform the charge.
query postsListQuery($terms: JSON) {
postsTotal(terms: $terms)
postsList(terms: $terms) {
__typename
...PostsList
}
}
fragment PostsList on Post {
export default function withMutation({name, args}) {
let mutation;
if (args) {
const args1 = _.map(args, (type, name) => `$${name}: ${type}`); // e.g. $url: String
const args2 = _.map(args, (type, name) => `${name}: $${name}`); // e.g. $url: url
mutation = `
mutation ${name}(${args1}) {
${name}(${args2})
let mutation;
if (args) {
const args1 = _.map(args, (type, name) => `$${name}: ${type}`); // e.g. $url: String
const args2 = _.map(args, (type, name) => `${name}: $${name}`); // e.g. $url: url
mutation = `
mutation ${name}(${args1}) {
${name}(${args2})
}
`
import { graphql } from 'react-apollo';
import gql from 'graphql-tag';
class MyComponent extends Component { ... }
const getMetaDataMutation = gql`
mutation getMetaData($url: String) {
getMetaData(url: $url) {
thumbnailUrl
viewCount
export default function withGetMetaDataMutation(component) {
return graphql(gql`
mutation getMetaData($url: String) {
getMetaData(url: $url) {
thumbnailUrl
viewCount
tweetCount
}
}
`, {
import { graphql } from 'react-apollo';
import gql from 'graphql-tag';
export default function withGetMetaDataMutation(component) {
return graphql(gql`
mutation getMetaData($url: String) {
getMetaData(url: $url) {
thumbnailUrl
viewCount
tweetCount