Memanfaatkan feathers-vuex untuk melakukan integrasi data antara feathers supplied dengan local store menggunakan Vuex.
import Vue from 'vue'
import Vuex from 'vuex'
import feathersVuex from 'feathers-vuex'
import Api from './api'
const { service, auth, FeathersVuex } = feathersVuex(Api, { })
Vue.use(Vuex)
Vue.use(FeathersVuex)
export default new Vuex.Store({
state: {
},
mutations: {
},
actions: {
},
plugins: [
service('users'),
// Setup the auth plugin.
auth({ userService: 'users' })
]
})
import feathers from '@feathersjs/feathers'
import socketio from '@feathersjs/socketio-client'
import auth from '@feathersjs/authentication-client'
import io from 'socket.io-client'
const socket = io('http://localhost:4937', { transports: ['websocket'] })
const Api = feathers()
.configure(socketio(socket))
.configure(auth({ storage: window.localStorage }))
export default Api
Instal paket yang dibutuhkan untuk melakukan integrasi feathersjs dengan Vue
$ yarn add @feathersjs/feathers @feathersjs/socketio-client @feathersjs/authentication-client socket.io-client feathers-vuex
Initialisasi feathers client di dalam file src/api.js
Integrasi feathers ke dalam local store Vue di file src/store.js