Create run mutation
This commit is contained in:
@@ -50,7 +50,7 @@ module.exports = {
|
|||||||
// Paths
|
// Paths
|
||||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||||
assetsSubDirectory: 'static',
|
assetsSubDirectory: 'static',
|
||||||
assetsPublicPath: '/lunchrun-public/',
|
assetsPublicPath: '/',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source Maps
|
* Source Maps
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import gql from 'graphql-tag'
|
|
||||||
import listRuns from '../queries/listRuns'
|
import listRuns from '../queries/listRuns'
|
||||||
|
import createRun from '../mutations/createRun'
|
||||||
export default {
|
export default {
|
||||||
name: 'Start',
|
name: 'Start',
|
||||||
data () {
|
data () {
|
||||||
@@ -27,19 +27,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addRun() {
|
addRun () {
|
||||||
const name = this.name
|
const name = this.name
|
||||||
this.$apollo.mutate({
|
this.$apollo.mutate({
|
||||||
mutation: gql`mutation ($name: String!) {
|
mutation: createRun,
|
||||||
createRun(input: { id: 1, name: $name }) {
|
|
||||||
id, name
|
|
||||||
}
|
|
||||||
}`,
|
|
||||||
variables: {
|
variables: {
|
||||||
name: name
|
name: name
|
||||||
},
|
|
||||||
update: (store, { data: { newRun } }) => {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
|
|||||||
6
frontend/src/mutations/createRun.js
Normal file
6
frontend/src/mutations/createRun.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
export default gql`mutation ($name: String!) {
|
||||||
|
createRun(input: { name: $name }) {
|
||||||
|
id, name
|
||||||
|
}
|
||||||
|
}`
|
||||||
Reference in New Issue
Block a user