Skip to content

Cannot read property 'create' of undefined #2

@devSarry

Description

@devSarry

I've basically just run through the set up and I cant seem to get the services bound to vue. Any suggestions?

Here's my client setup.

import Vue from 'vue'
import Resource from 'vue-resource'
import Router from 'vue-router'

// Install plugins
Vue.use(Router)
Vue.use(Resource)

// Set up a new router

const Feathers = require('feathers/client')
const hooks = require('feathers-hooks')
const authentication = require('feathers-authentication/client')
const socketio = require('feathers-socketio/client')
const io = require('socket.io-client')

const socket = io('http://localhost:3030/')
const feathers = Feathers()
    .configure(socketio(socket))
    .configure(hooks())
    .configure(authentication({storage: window.localStorage}))
console.log(feathers)
const vueFeathers = require('vue-feathers')

// And plug it in
Vue.use(vueFeathers, feathers)

Heres the component that is calling it.

    export default {
        name: "Chat",

        data() {
             return {
                 message: ''
             }
        },

        methods: {
            send(){
                this.$services.messages.create(this.message);
                console.log(this.$services);
            }
        }
    }

Error in browser

VM1043:1 Uncaught TypeError: Cannot read property 'create' of undefined
    at <anonymous>:1:24

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions