Skip to content

Commit 184dd9a

Browse files
committed
More docs
1 parent deee57f commit 184dd9a

File tree

4 files changed

+45
-9
lines changed

4 files changed

+45
-9
lines changed

docs/guide/eager-loading/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ be added to a static field in the model called `eagerLoad` to have them eagerly
77

88
Example:
99

10-
```javascript
10+
```javascript{3}
1111
class User extends Model {
1212
static entity = 'users';
1313
static eagerLoad = ['posts'];

docs/guide/fetch/README.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,50 @@ const comments = Comment.getters('all');
5252
When fetching all returned records replace the respective existing records in the Vuex-ORM database.
5353

5454

55-
## Fetching single record
55+
## Fetching a single record
5656

57-
::: danger
58-
TODO
59-
:::
57+
You can also fetch single records via ID:
6058

59+
```javascript
60+
Comment.dispatch('fetch', { filter: { id: 42 }});
61+
```
62+
63+
It automatically recognizes, that you're requesting a single record and sends a GraphQL Query for a single record:
64+
65+
```graphql
66+
query Comment($id: ID!) {
67+
comment(id: $id) {
68+
id
69+
content
70+
postId
71+
userId
72+
73+
user {
74+
id
75+
email
76+
}
77+
78+
post {
79+
id
80+
content
81+
title
82+
83+
user {
84+
id
85+
email
86+
}
87+
}
88+
}
89+
}
90+
```
6191

6292

6393
## Filtering
6494

6595
Additionally you can pass a filter object to the fetch action like this:
6696

6797
```javascript
68-
Comment.dispatch('fetch', { postId: 15, deleted: false });
98+
Comment.dispatch('fetch', { filter: { postId: 15, deleted: false }});
6999
```
70100

71101
This will generate the following GraphQL query:

docs/guide/relationships/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ TODO
197197

198198

199199
::: danger
200-
*TODO:*
200+
**TODO:**
201201

202202
- Example Queries
203203
:::

docs/guide/setup/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ These are the possible options to pass when calling `VuexORM.use()`:
2828

2929
- `database` (required): The Vuex-ORM database.
3030
- `url` (optional, default: '/graphql'): The URL to the graphql api. Will be passed to apollo-client.
31-
- `debug` (optional, default: false): Set to true to activate the debug logging. We recommend to activate this in
32-
development env.
31+
- `debug` (optional, default: false): Set to true to activate the debug logging.
3332

3433
More options will come in future releases.
34+
35+
::: tip
36+
We recommend to activate the debug mode in development env automatically via:
37+
```javascript
38+
{ debug: process.env.NODE_ENV !== 'production' }
39+
```
40+
:::

0 commit comments

Comments
 (0)