Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs: Add example for Apollo GraphQL + composition API #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
afontcu merged 11 commits into testing-library:next from agualis:next
Dec 17, 2020
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove not used import
  • Loading branch information
agualis committed Dec 12, 2020
commit 22e7f843c86da23d8e13e9eed3cdb5d0d095f864
30 changes: 13 additions & 17 deletions src/__tests__/components/VueApollo.vue
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<div v-if="loading">Loading</div>
<div v-if="loading">Loading</div>

<div v-if="user">
<div>Email: {{ user.email }}</div>
Expand All @@ -16,11 +16,9 @@
</template>

<script>
import {reactive, ref} from 'vue'
import {useQuery, useMutation, useResult} from "@vue/apollo-composable";
import {reactive, ref} from 'vue'
import {useQuery, useMutation, useResult} from '@vue/apollo-composable'
import {updateUserMutation, getUserQuery} from './VueApollo/queries'
import {gql} from 'apollo-boost'


export default {
props: {
Expand All @@ -31,20 +29,18 @@ export default {
},
setup(props) {
const email = ref('')
const {result, loading, error} = useQuery(getUserQuery, {id: props.id})

const {result, loading, error} = useQuery(getUserQuery, {id: props.id})
const user = useResult(result, null, data => data.user)

const {mutate: updateUser} = useMutation(updateUserMutation,
()=> ({variables:
{
input: {
email: email.value,
id: props.id,
},
}
})
)
const {mutate: updateUser} = useMutation(updateUserMutation, () => ({
variables: {
input: {
email: email.value,
id: props.id,
},
},
}))

return {
email,
Expand Down

AltStyle によって変換されたページ (->オリジナル) /