You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A realtime-transport like Socket.io or Primus is required in order to take advantage of the real-time socket events built into Feathers-Vuex. The `feathers-hooks-common` package, specified below, is not required to work with Feathers-Vuex.
59
60
60
-
1.[Setup the Feathers client and Feathers-Vuex](#setup-the-feathers-client-and-feathers-vuex)
61
-
2.[Define a Model class and service plugin for each service](#setup-one-or-more-service-plugins)
62
-
3.[Setup the auth plugin](#setup-the-auth-plugin), if required.
63
-
4. Register the plugins with the Vuex store.
61
+
```bash
62
+
npm i @feathersjs/feathers @feathersjs/socketio-client @feathersjs/authentication-client socket.io-client feathers-vuex feathers-hooks-common --save
To setup `feathers-vuex`, we first need to setup the latest Feathers client. We can also setup feathers-vuex in the same file.
69
+
### With feathers-rest
68
70
69
-
First, let's install dependencies.
71
+
Feathers-Vuex works with Feathers-Rest, but keep in mind that the `feathers-rest` client does not listen to socket events. The `feathers-hooks-common` package, specified below, is not required to work with Feathers-Vuex.
70
72
71
73
```bash
72
-
npm i @feathersjs/feathers @feathersjs/socketio-client @feathersjs/authentication-client feathers-hooks-common socket.io-client feathers-vuex --save
74
+
npm i @feathersjs/feathers @feathersjs/rest-client @feathersjs/authentication-client feathers-hooks-common feathers-vuex --save
1.[Setup the Feathers client and Feathers-Vuex](#setup-the-feathers-client-and-feathers-vuex)
86
+
2.[Define a Model class and service plugin for each service](#setup-one-or-more-service-plugins)
87
+
3.[Setup the auth plugin](#setup-the-auth-plugin), if required.
88
+
4. Register the plugins with the Vuex store.
89
+
90
+
### Feathers Client & Feathers-Vuex
91
+
92
+
To setup `feathers-vuex`, we first need to setup the latest Feathers client. We can also setup feathers-vuex in the same file. Depending on your requirements, you'll need to install the feathers-client dependencies, as shown, above.
93
+
79
94
Note that this example includes an app-level hook that removes attributes for handling temporary (local-only) records.
The following example creates a User class and registers it with the new `makeServicePlugin` utility function. This same file is also a great place to add your service-level hooks, so they're shown, too.
[Read more about the Auth Plugin](/auth-plugin.html).
195
210
196
-
### Add the plugins to the Vuex store.
211
+
### Vuex store
197
212
198
213
```js
199
214
// src/store/store.js
@@ -223,18 +238,20 @@ export default new Vuex.Store({
223
238
actions: {},
224
239
plugins: [...servicePlugins, auth]
225
240
})
226
-
227
241
```
228
242
229
-
The new `feathers-vuex` API is more Vuex-like. All of the functionality remains the same, but it is no longer configured like a FeathersJS plugin. While the previous functionality was nice for prototyping, it didn't work well in SSR scenarios, like with Nuxt.
243
+
## Begin Using Feathers-Vuex
230
244
231
-
To see `feathers-vuex`in a working vue-cli application, check out [`feathers-chat-vuex`](https://github.com/feathers-plus/feathers-chat-vuex).
245
+
There are a couple of ways to use Feathers-Vuex. Version 2.0 heavily focuses on abstracting away the Vuex syntax in favor of using [Model classes](/model-classes.html). The Model classes are a layer on top of the Vuex getters, mutations, and actions. You can, of course, also directly use the [service plugin's getters, mutations, and actions](/service-plugin.html).
232
246
233
-
## Note about feathers-reactive
247
+
There are two plugins included:
234
248
235
-
Previous versions of this plugin required both RxJS and `feathers-reactive` to receive realtime updates. `[email protected]` has socket messaging support built in and takes advantage of Vuex reactivity, so RxJS and `feathers-reactive` are no longer required or supported.
249
+
1. The [Service Plugin](./service-plugin.md) adds a Vuex store for new services.
250
+
2. The [Auth Plugin](./auth-plugin.md) sets up the Vuex store for authentication / logout.
251
+
252
+
To see `feathers-vuex` in a working vue-cli application, check out [`feathers-chat-vuex`](https://github.com/feathers-plus/feathers-chat-vuex).
236
253
237
-
## Global Configuration
254
+
###Global Configuration
238
255
239
256
The following default options are available for configuration:
240
257
@@ -248,17 +265,15 @@ const defaultOptions = {
248
265
}
249
266
```
250
267
251
-
Each service module can also be individually configured.
252
-
253
-
## The Vuex Plugins
268
+
### Note about feathers-reactive
254
269
255
-
There are two plugins included:
270
+
Previous versions of this plugin required both RxJS and `feathers-reactive` to receive realtime updates. `[email protected]` has socket messaging support built in and takes advantage of Vuex reactivity, so RxJS and `feathers-reactive`are no longer required or supported.
256
271
257
-
1. The [Service Plugin](./service-plugin.md) adds a Vuex store for new services.
258
-
2. The [Auth Plugin](./auth-plugin.md) sets up the Vuex store for authentication / logout.
272
+
Each service module can also be individually configured.
259
273
260
274
## License
261
275
262
-
Copyright (c) Forever, or at least the current year.
263
-
264
276
Licensed under the [MIT license](LICENSE).
277
+
278
+
Feathers-Vuex is developed and maintained by [Marshall Thompson](https://www.github.com/marshallswain).
0 commit comments