@@ -26,17 +26,17 @@ query Comments {
2626 content
2727 postId
2828 userId
29-
29+
3030 user {
3131 id
3232 email
3333 }
34-
34+
3535 post {
3636 id
3737 content
3838 title
39-
39+
4040 user {
4141 id
4242 email
@@ -64,11 +64,11 @@ When fetching all returned records replace the respective existing records in th
6464You can also fetch single records via ID:
6565
6666``` javascript
67- await Comment .fetch (42 );
67+ await Comment .fetch (' 42 ' );
6868// or
69- await Comment .fetch ({ id: 42 });
69+ await Comment .fetch ({ id: ' 42 ' });
7070// or
71- await Comment .dispatch (' fetch' , { filter: { id: 42 }})
71+ await Comment .dispatch (' fetch' , { filter: { id: ' 42 ' }})
7272```
7373
7474It 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!) {
8080 content
8181 postId
8282 userId
83-
83+
8484 user {
8585 id
8686 email
8787 }
88-
88+
8989 post {
9090 id
9191 content
9292 title
93-
93+
9494 user {
9595 id
9696 email
@@ -106,10 +106,10 @@ query Comment($id: ID!) {
106106Additionally you can pass a filter object to the fetch action like this:
107107
108108``` javascript
109- await Comment .fetch ({ postId: 15 , deleted: false });
109+ await Comment .fetch ({ postId: ' 15 ' , deleted: false });
110110// or
111- await Comment .dispatch (' fetch' , { filter: { postId: 15 , deleted: false }})
112- ```
111+ await Comment .dispatch (' fetch' , { filter: { postId: ' 15 ' , deleted: false }})
112+ ```
113113
114114This will generate the following GraphQL query:
115115
@@ -121,17 +121,17 @@ query Comments($postId: ID!, $deleted: Boolean!) {
121121 content
122122 postId
123123 userId
124-
124+
125125 user {
126126 id
127127 email
128128 }
129-
129+
130130 post {
131131 id
132132 content
133133 title
134-
134+
135135 user {
136136 id
137137 email
@@ -160,20 +160,20 @@ recommend the usage of async/await.
160160 export default {
161161 // Use a computed property for the component state to keep it reactive
162162 computed: {
163- post: () => Post.find(1 )
163+ post: () => Post.find('1' )
164164 },
165-
165+
166166 created () {
167167 // fetch the data when the view is created and the data is
168168 // already being observed
169169 this.fetchData();
170170 },
171-
171+
172172 watch: {
173173 // call again the method if the route changes
174174 '$route': 'fetchData'
175175 },
176-
176+
177177 methods: {
178178 // Loads the data from the server and stores them in the Vuex Store.
179179 async fetchData () {
@@ -191,7 +191,7 @@ The plugin caches same queries. To bypass caching set the second param of the `f
191191when using the convenience method or add ` bypassCache: true ` to the arguments of the ` dispatch() ` call
192192
193193``` javascript
194- await Comment .fetch ({ id: 42 }, true );
194+ await Comment .fetch ({ id: ' 42 ' }, true );
195195// Or
196- await Comment .dispatch (' fetch' , { filter: { id: 42 }, bypassCache: true })
196+ await Comment .dispatch (' fetch' , { filter: { id: ' 42 ' }, bypassCache: true })
197197```
0 commit comments