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
Copy file name to clipboardExpand all lines: README.md
+67-1Lines changed: 67 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,14 +49,80 @@ Vuex ORM is sponsored by awesome folks. Big love to all of them from whole Vuex
49
49
50
50
## Documentation
51
51
52
-
Coming soon...
52
+
You can check out the full documentation for Vuex ORM Axios at https://vuex-orm.github.io/plugin-axios.
53
53
54
54
## Questions & Discussions
55
55
56
56
Join us on our [Slack Channel](https://join.slack.com/t/vuex-orm/shared_invite/enQtNDQ0NjE3NTgyOTY2LTc1YTI2N2FjMGRlNGNmMzBkMGZlMmYxOTgzYzkzZDM2OTQ3OGExZDRkN2FmMGQ1MGJlOWM1NjU0MmRiN2VhYzQ) for any questions and discussions.
57
57
58
58
Although there is the Slack Channel, do not hesitate to open an [issue](https://github.com/vuex-orm/vuex-orm/issues) for any question you might have. We're always more than happy to hear any feedback, and we don't care what kind of form they are.
59
59
60
+
## Quick Start
61
+
62
+
Here's a very simple quick start guide that demonstrates how it feels like to be using Vuex ORM Axios.
63
+
64
+
### Install and Setup Vuex ORM Axios
65
+
66
+
Install Vuex ORM Axios by npm or yarn. Note that the Vuex ORM Axios require Axios to be installed manually, so don't forget to install it too!
To plugin Vuex ORM Axios to Vuex ORM, pass Vuex ORM Axios to the `VuexORM.use` method. Here, you should pass your axios instance as an option.
75
+
76
+
```js
77
+
importaxiosfrom'axios'
78
+
importVuexORMfrom'@vuex-orm/core'
79
+
importVuexORMAxiosfrom'@vuex-orm/plugin-axios'
80
+
81
+
VuexORM.use(VuexORMAxios, { axios })
82
+
```
83
+
84
+
### Usage
85
+
86
+
After setting up Vuex ORM Axios, you may use `Model.api` method to perform api call.
87
+
88
+
```js
89
+
User.api().get('/api/users')
90
+
```
91
+
92
+
Vuex ORM Axios can perform all basic Axios requests, which is `get`, `post`, `put`, `patch`, `delete`, and `request`. These methods take the same arguments as Axios and perform exactly as same as Axios, except it's going to store response data to the store corresponding to the Model that is calling the api.
93
+
94
+
Vuex ORM Axios lets you define the "Custom Actions" as well. Like this.
95
+
96
+
```js
97
+
classUserextendsModel {
98
+
static entity ='users'
99
+
100
+
staticfields () {
101
+
return {
102
+
id:this.attr(null),
103
+
name:this.attr('')
104
+
}
105
+
}
106
+
107
+
static apiConfig = {
108
+
actions: {
109
+
fetch: {
110
+
method:'get',
111
+
url:'/api/users'
112
+
}
113
+
}
114
+
}
115
+
}
116
+
```
117
+
118
+
And then, you can use the above `fetch` method through your model.
119
+
120
+
```js
121
+
User.api().fetch()
122
+
```
123
+
124
+
Now, are you ready to learn more about the plugin? Let's [jump right into it](https://vuex-orm.github.io/plugin-axios).
125
+
60
126
## Plugins
61
127
62
128
Vuex ORM can be extended via a plugin to add additional features. Here is the list of available plugins.
0 commit comments