Create run mutation
This commit is contained in:
@@ -50,7 +50,7 @@ module.exports = {
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/lunchrun-public/',
|
||||
assetsPublicPath: '/',
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import gql from 'graphql-tag'
|
||||
import listRuns from '../queries/listRuns'
|
||||
import createRun from '../mutations/createRun'
|
||||
export default {
|
||||
name: 'Start',
|
||||
data () {
|
||||
@@ -30,16 +30,9 @@ export default {
|
||||
addRun () {
|
||||
const name = this.name
|
||||
this.$apollo.mutate({
|
||||
mutation: gql`mutation ($name: String!) {
|
||||
createRun(input: { id: 1, name: $name }) {
|
||||
id, name
|
||||
}
|
||||
}`,
|
||||
mutation: createRun,
|
||||
variables: {
|
||||
name: name
|
||||
},
|
||||
update: (store, { data: { newRun } }) => {
|
||||
|
||||
}
|
||||
}).then((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