Skip to content

Commit

Permalink
feat(components): loading event
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed May 21, 2019
1 parent 93da3c8 commit 04891de
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api/apollo-mutation.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ Example:

- `done(resultObject)`
- `error(errorObject)`
- `loading(boolean)`
1 change: 1 addition & 0 deletions docs/api/apollo-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ To enable support of `gql` string tag in Vue templates, see the necessary setup

- `result(resultObject)`
- `error(errorObject)`
- `loading(boolean)`
6 changes: 6 additions & 0 deletions src/components/ApolloMutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export default {
}
},

watch: {
loading (value) {
this.$emit('loading', value)
},
},

methods: {
mutate (options) {
this.loading = true
Expand Down
4 changes: 4 additions & 0 deletions src/components/ApolloQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export default {
notifyOnNetworkStatusChange: value,
})
},

'$data.$apolloData.loading' (value) {
this.$emit('loading', !!value)
},
},

apollo: {
Expand Down

0 comments on commit 04891de

Please sign in to comment.