@@ -26,17 +26,17 @@ query Comments {
26
26
content
27
27
postId
28
28
userId
29
-
29
+
30
30
user {
31
31
id
32
32
email
33
33
}
34
-
34
+
35
35
post {
36
36
id
37
37
content
38
38
title
39
-
39
+
40
40
user {
41
41
id
42
42
email
@@ -64,11 +64,11 @@ When fetching all returned records replace the respective existing records in th
64
64
You can also fetch single records via ID:
65
65
66
66
``` javascript
67
- await Comment .fetch (42 );
67
+ await Comment .fetch (' 42 ' );
68
68
// or
69
- await Comment .fetch ({ id: 42 });
69
+ await Comment .fetch ({ id: ' 42 ' });
70
70
// or
71
- await Comment .dispatch (' fetch' , { filter: { id: 42 }})
71
+ await Comment .dispatch (' fetch' , { filter: { id: ' 42 ' }})
72
72
```
73
73
74
74
It automatically recognizes, that you're requesting a single record and sends a GraphQL Query for a single record:
@@ -80,17 +80,17 @@ query Comment($id: ID!) {
80
80
content
81
81
postId
82
82
userId
83
-
83
+
84
84
user {
85
85
id
86
86
email
87
87
}
88
-
88
+
89
89
post {
90
90
id
91
91
content
92
92
title
93
-
93
+
94
94
user {
95
95
id
96
96
email
@@ -106,10 +106,10 @@ query Comment($id: ID!) {
106
106
Additionally you can pass a filter object to the fetch action like this:
107
107
108
108
``` javascript
109
- await Comment .fetch ({ postId: 15 , deleted: false });
109
+ await Comment .fetch ({ postId: ' 15 ' , deleted: false });
110
110
// or
111
- await Comment .dispatch (' fetch' , { filter: { postId: 15 , deleted: false }})
112
- ```
111
+ await Comment .dispatch (' fetch' , { filter: { postId: ' 15 ' , deleted: false }})
112
+ ```
113
113
114
114
This will generate the following GraphQL query:
115
115
@@ -121,17 +121,17 @@ query Comments($postId: ID!, $deleted: Boolean!) {
121
121
content
122
122
postId
123
123
userId
124
-
124
+
125
125
user {
126
126
id
127
127
email
128
128
}
129
-
129
+
130
130
post {
131
131
id
132
132
content
133
133
title
134
-
134
+
135
135
user {
136
136
id
137
137
email
@@ -160,20 +160,20 @@ recommend the usage of async/await.
160
160
export default {
161
161
// Use a computed property for the component state to keep it reactive
162
162
computed: {
163
- post: () => Post.find(1 )
163
+ post: () => Post.find('1' )
164
164
},
165
-
165
+
166
166
created () {
167
167
// fetch the data when the view is created and the data is
168
168
// already being observed
169
169
this.fetchData();
170
170
},
171
-
171
+
172
172
watch: {
173
173
// call again the method if the route changes
174
174
'$route': 'fetchData'
175
175
},
176
-
176
+
177
177
methods: {
178
178
// Loads the data from the server and stores them in the Vuex Store.
179
179
async fetchData () {
@@ -191,7 +191,7 @@ The plugin caches same queries. To bypass caching set the second param of the `f
191
191
when using the convenience method or add ` bypassCache: true ` to the arguments of the ` dispatch() ` call
192
192
193
193
``` javascript
194
- await Comment .fetch ({ id: 42 }, true );
194
+ await Comment .fetch ({ id: ' 42 ' }, true );
195
195
// Or
196
- await Comment .dispatch (' fetch' , { filter: { id: 42 }, bypassCache: true })
196
+ await Comment .dispatch (' fetch' , { filter: { id: ' 42 ' }, bypassCache: true })
197
197
```
0 commit comments