Skip to content

Instantly share code, notes, and snippets.

@pixelbacon
Created December 20, 2018 19:36
Show Gist options
  • Save pixelbacon/3fdb30f8c85283868109a92cf16cde89 to your computer and use it in GitHub Desktop.
Save pixelbacon/3fdb30f8c85283868109a92cf16cde89 to your computer and use it in GitHub Desktop.
import gql from 'graphql-tag'
const query = gql`query user($id: ID!) {
user(
where: {
id: $id
}
) {
id
createdAt
avatar
}`
export default {
props: {
userId: {
type: String,
required: false
}
},
apollo: {
user: {
query,
variables() {
return {
id: this.userId,
};
},
skip() {
return !this.userId;
},
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment