DEV Community

Discussion on: Vue SPA with Rails JSON:API using Graphiti

Collapse
 
sagar2agrawal profile image
Sagar Agrawal

Hello,

so I have been working on vue and jsorm/spraypaint for some time and i am stuck with, like how to make a fetch request instead of Post and send some metadata also with it.

like send data to customer/:id, where the id would be fetched from the url and send as meta data, while secrets from the URL to be send as normal data.

import { ApplicationRecord } from './application_record';

export const Post = ApplicationRecord.extend({
static: {
jsonapiType: 'posts/:id'
},

attrs: {
    id: attr(),
    title: attr(),
    content: attr()
},

methods: {
    preview() {
        return this.content.slice(0, 50).trim() + '...'
    }
}

})