Description
I'm having problems making queries and creating / updating / deleting things in django graphql through the graphql plugin of vuex orm.
From the interface provided by django to execute queries, I can perfectly use my mutations and consult any particular data or any collection of them.
The error I receive is the following:
As far as I understand the plugin, this error is given in the schema constructor but i don't understand why.
I'm going to write an example of how I create an object called "TipoProducto" from the django interface:
mutation myMutation {
createTipoProducto(input: {nombre:"Pizza", descripcion:"foobar"}) {
tipoProducto {nombre, descripcion}
status
}
}
This code will return the object with its attributes and a status 200 if it was successful.
My model in vuex orm:
import { Model } from '@vuex-orm/core';
import Product from './Product'
export default class TipProd extends Model {
static entity = "tipProds"
static fields () {
return {
id: this.increment(),
nombre: this.attr(''),
descripcion: this.attr(''),
producto: this.hasMany(Product, 'tipProd_id')
}
}
}
This is the method I try to use to create a new object "TipoProducto":
methods: {
async register (tipProduct) {
await TipProd.insert({
data:
tipProduct
});
const tipProd = TipProd.query().last()
await tipProd.$mutate({ name: 'createTipoProducto' });
}
where data: tipProducto are the attributes taken from a form
I can not find the way that vuex orm correctly structured the query to create an object. What am I doing wrong?
I have apollo dev tools installed but it does not register any query or any other operation since it fails before being made.
I am aware that some methods could fail if I do not respect the naming conventions for schema operations from Django but it is not the case, I am not even able to do a simple fetch
Sorry for the english and thanks.