feat(subs): subscribe to branch and commit changes

- branch created, branch updated, branch deleted, and commit updated
- for more seamless user experience!
This commit is contained in:
izzy lyseggen
2021-07-02 14:40:14 +01:00
parent ca93150b0f
commit b956d751c9
+54 -6
View File
@@ -318,9 +318,7 @@ export default {
}
`,
variables() {
return {
id: this.savedStream.id
}
return { id: this.savedStream.id }
},
result() {
this.$apollo.queries.stream.refetch()
@@ -333,9 +331,7 @@ export default {
}
`,
variables() {
return {
streamId: this.savedStream.id
}
return { streamId: this.savedStream.id }
},
result(commitInfo) {
this.$apollo.queries.stream.refetch()
@@ -344,6 +340,58 @@ export default {
message: `New commit on ${this.stream.name} @ ${commitInfo.data.commitCreated.branchName}`
})
}
},
commitUpdated: {
query: gql`
subscription($id: String!) {
commitUpdated(streamId: $id)
}
`,
variables() {
return { id: this.savedStream.id }
},
result() {
this.$apollo.queries.stream.refetch()
}
},
branchCreated: {
query: gql`
subscription($id: String!) {
branchCreated(streamId: $id)
}
`,
variables() {
return { id: this.savedStream.id }
},
result() {
this.$apollo.queries.stream.refetch()
}
},
branchDeleted: {
query: gql`
subscription($id: String!) {
branchDeleted(streamId: $id)
}
`,
variables() {
return { id: this.savedStream.id }
},
result() {
this.$apollo.queries.stream.refetch()
}
},
branchUpdated: {
query: gql`
subscription($id: String!) {
branchUpdated(streamId: $id)
}
`,
variables() {
return { id: this.savedStream.id }
},
result() {
this.$apollo.queries.stream.refetch()
}
}
}
},