I get an error while sending data from Apollo to Hasura GraphQL:
Error: GraphQL error: variable price of type Float is used in position expecting float8
This is my code in nuxt js
import gql from 'graphql-tag';
const insert = gql`
mutation insert_test_float($price:Float){
insert_test_float(objects: {price: $price}) {
affected_rows
}
}
save() {
const price = this.frm.price
this.$apollo
.mutate({
mutation: insert, //require('~/apollo/mutations/test'),
variables: {
price: this.frm.price
}
})
.then((rs) => {
console.log(rs)
})
.catch((er) => {
console.log(er)
})
}
You should use float8
as your variable type instead of Float
as the error indicates.