Created
December 20, 2018 19:36
-
-
Save pixelbacon/3fdb30f8c85283868109a92cf16cde89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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