forked from feathersjs-ecosystem/feathers-chat-vuex-0.7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
feathers-client.js
36 lines (32 loc) · 1.13 KB
/
feathers-client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import 'babel-polyfill'
import feathers from 'feathers'
import hooks from 'feathers-hooks'
import socketio from 'feathers-socketio'
import auth from 'feathers-authentication-client'
import io from 'socket.io-client'
import feathersVuex from 'feathers-vuex'
import store from '@/store/'
import rx from 'feathers-reactive'
import RxJS from 'rxjs'
const socket = io('http://localhost:3030', {transports: ['websocket']})
const feathersClient = feathers()
.configure(hooks())
.configure(socketio(socket))
.configure(auth({ storage: window.localStorage }))
.configure(rx(RxJS, {idField: '_id'}))
.configure(feathersVuex(store, {
idField: '_id',
auth: {
userService: '/users'
}
}, {
// 'messages': { namespace: 'chats/messages' },
'messages': { namespace: ['chats', 'messages'] },
'users': { namespace: 'chats/users' }
}))
feathersClient.service('/users')
feathersClient.service('/messages')
// feathersClient.service('/todos').vuex({idField: '_id'})
// feathersClient.service('/deeply/nested/names')
// feathersClient.service('/some/explicit/namespace').vuex({name: '/explicit/namespace'})
export default feathersClient