Skip to content

Instantly share code, notes, and snippets.

@dustinfarris
Last active November 30, 2016 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustinfarris/de3a019616b366d610e794a302883dfd to your computer and use it in GitHub Desktop.
Save dustinfarris/de3a019616b366d610e794a302883dfd to your computer and use it in GitHub Desktop.
import Ember from 'ember';
import hbs from 'htmlbars-inline-precompile';
import connect from 'ember-redux/components/connect';
import { cashay } from 'cashay';
const capitalsQuery = `
{
missouriCapital: capital(state: MISSOURI) {
name
size(unit: SQ_MI)
}
newYorkCapital: capital(state: NEW_YORK) {
name
size(unit: SQ_KM)
}
}`;
const stateToComputed = () => {
const {
data: { missouriCapital, newYorkCapital }
} = cashay.query(capitalsQuery);
return { missouriCapital, newYorkCapital };
};
export default connect(stateToComputed)(Ember.Component);
<h1>Capitals</h1>
<div>
<h2>Missouri</h2>
Name: {{missouriCapital.name}}
Size: {{missouriCapital.size}} square miles
</div>
<div>
<h2>New York</h2>
Name: {{newYorkCapital.name}}
Size: {{newYorkCapital.size}} square kilometers
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment