[Vuejs]-Vue.js component form sends null values

0👍

OG Solution by cperez

Depending on your server, you need to ‘stringify’ your parameters object within your post function in two possible ways. If your server accepts JSON, then:

return Api().post('entities', 
    JSON.stringify({
        title: params.title,
        description: this.description
    })
)

If you server doesn’t accept JSON, you have to convert the object into encoded URL parameters with the querystring module:

var qs = require('querystring');

return Api().post('entities', 
    qs.stringify({
        title: params.title,
        description: this.description
    })
)

Leave a comment