Skip to content

Commit 72fa4b3

Browse files
committed
Update docs
1 parent eff2927 commit 72fa4b3

10 files changed

+86
-86
lines changed

docs/guide/custom-queries.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ specific type. Also the return value is not automatically inserted in the Vuex s
1414

1515
::: warning
1616
It's not a clean and good solution that the simple queries are also triggered via Vuex action, but currently the only
17-
way. This might be changed in the future, when we find a better solution.
17+
way. This might be changed in the future, when we find a better solution.
1818
:::
1919

2020

@@ -67,7 +67,7 @@ Variables:
6767

6868
```json
6969
{
70-
"id": 42
70+
"id": "42"
7171
}
7272
```
7373

@@ -119,7 +119,7 @@ Following fields are allowed:
119119

120120
::: tip
121121
As `query` you can also pass a GraphQL AST DocumentNode like it's returned by the `gql` function or
122-
the `*.graphql` webpack loader of [graphql-tag](https://github.com/apollographql/graphql-tag).
122+
the `*.graphql` webpack loader of [graphql-tag](https://github.com/apollographql/graphql-tag).
123123
:::
124124

125125
## Model related custom mutation
@@ -169,7 +169,7 @@ Variables:
169169

170170
```json
171171
{
172-
"id": 42
172+
"id": "42"
173173
}
174174
```
175175

@@ -222,7 +222,7 @@ Following fields are allowed:
222222

223223
::: tip
224224
As `query` you can also pass a GraphQL AST DocumentNode like it's returned by the `gql` function or
225-
the `*.graphql` webpack loader of [graphql-tag](https://github.com/apollographql/graphql-tag).
225+
the `*.graphql` webpack loader of [graphql-tag](https://github.com/apollographql/graphql-tag).
226226
:::
227227

228228

docs/guide/destroy.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mutation DeletePost($id: ID!) {
2525
id
2626
title
2727
content
28-
28+
2929
user {
3030
id
3131
email
@@ -38,7 +38,7 @@ Variables:
3838

3939
```json
4040
{
41-
"id": 42
41+
"id": "42"
4242
}
4343
```
4444

docs/guide/eager-loading.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class User extends Model {
1818
1919
static fields () {
2020
return {
21-
id: this.attr(null),
22-
name: this.attr(''),
23-
21+
id: this.uid(),
22+
name: this.string(''),
23+
2424
posts: this.hasMany(Post, 'userId')
2525
}
2626
}
@@ -43,9 +43,9 @@ class User extends Model {
4343
4444
static fields () {
4545
return {
46-
id: this.attr(null),
47-
name: this.attr(''),
48-
46+
id: this.uid(),
47+
name: this.string(''),
48+
4949
posts: this.hasMany(Post, 'userId')
5050
}
5151
}
@@ -66,9 +66,9 @@ class User extends Model {
6666
6767
static fields () {
6868
return {
69-
id: this.attr(null),
70-
name: this.attr(''),
71-
69+
id: this.uid(),
70+
name: this.string(''),
71+
7272
posts: this.hasMany(Post, 'userId')
7373
}
7474
}

docs/guide/fetch.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -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
6464
You 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

7474
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!) {
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!) {
106106
Additionally 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

114114
This 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
191191
when 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
```

docs/guide/persist.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ Variables:
4646
```json
4747
{
4848
"post": {
49-
"id": 42,
50-
"userId": 15,
49+
"id": "42",
50+
"userId": "15",
5151
"content": "Lorem Ipsum dolor sit amet",
5252
"title": "Example Post",
5353
"user": {
54-
"id": 15,
54+
"id": "15",
5555
"email": "[email protected]"
5656
}
5757
}

docs/guide/push.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ Variables:
3737

3838
```json
3939
{
40-
"id": 42,
40+
"id": "42",
4141
"post": {
42-
"id": 42,
43-
"userId": 15,
42+
"id": "42",
43+
"userId": "15",
4444
"content": "Some more exciting content!",
4545
"title": "Not a example post",
4646
"user": {
47-
"id": 15,
47+
"id": "15",
4848
"email": "[email protected]"
4949
}
5050
}
@@ -58,7 +58,7 @@ Like when persisting, all records which are returned replace the respective exis
5858
## Additional variables
5959

6060
You can pass a object like this: `$push({ captchaToken: 'asdfasdf' })`. All fields in the object will be passed as
61-
variables to the mutation.
61+
variables to the mutation.
6262

6363

6464
## Relationships

0 commit comments

Comments
 (0)