Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
phortx committed Apr 30, 2020
1 parent eff2927 commit 72fa4b3
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 86 deletions.
10 changes: 5 additions & 5 deletions docs/guide/custom-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ specific type. Also the return value is not automatically inserted in the Vuex s

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


Expand Down Expand Up @@ -67,7 +67,7 @@ Variables:

```json
{
"id": 42
"id": "42"
}
```

Expand Down Expand Up @@ -119,7 +119,7 @@ Following fields are allowed:

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

## Model related custom mutation
Expand Down Expand Up @@ -169,7 +169,7 @@ Variables:

```json
{
"id": 42
"id": "42"
}
```

Expand Down Expand Up @@ -222,7 +222,7 @@ Following fields are allowed:

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


Expand Down
4 changes: 2 additions & 2 deletions docs/guide/destroy.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mutation DeletePost($id: ID!) {
id
title
content

user {
id
email
Expand All @@ -38,7 +38,7 @@ Variables:

```json
{
"id": 42
"id": "42"
}
```

Expand Down
18 changes: 9 additions & 9 deletions docs/guide/eager-loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class User extends Model {
static fields () {
return {
id: this.attr(null),
name: this.attr(''),
id: this.uid(),
name: this.string(''),
posts: this.hasMany(Post, 'userId')
}
}
Expand All @@ -43,9 +43,9 @@ class User extends Model {
static fields () {
return {
id: this.attr(null),
name: this.attr(''),
id: this.uid(),
name: this.string(''),
posts: this.hasMany(Post, 'userId')
}
}
Expand All @@ -66,9 +66,9 @@ class User extends Model {
static fields () {
return {
id: this.attr(null),
name: this.attr(''),
id: this.uid(),
name: this.string(''),
posts: this.hasMany(Post, 'userId')
}
}
Expand Down
42 changes: 21 additions & 21 deletions docs/guide/fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ query Comments {
content
postId
userId

user {
id
email
}

post {
id
content
title

user {
id
email
Expand Down Expand Up @@ -64,11 +64,11 @@ When fetching all returned records replace the respective existing records in th
You can also fetch single records via ID:

```javascript
await Comment.fetch(42);
await Comment.fetch('42');
// or
await Comment.fetch({ id: 42 });
await Comment.fetch({ id: '42' });
// or
await Comment.dispatch('fetch', { filter: { id: 42 }})
await Comment.dispatch('fetch', { filter: { id: '42' }})
```

It automatically recognizes, that you're requesting a single record and sends a GraphQL Query for a single record:
Expand All @@ -80,17 +80,17 @@ query Comment($id: ID!) {
content
postId
userId

user {
id
email
}

post {
id
content
title

user {
id
email
Expand All @@ -106,10 +106,10 @@ query Comment($id: ID!) {
Additionally you can pass a filter object to the fetch action like this:

```javascript
await Comment.fetch({ postId: 15, deleted: false });
await Comment.fetch({ postId: '15', deleted: false });
// or
await Comment.dispatch('fetch', { filter: { postId: 15, deleted: false }})
```
await Comment.dispatch('fetch', { filter: { postId: '15', deleted: false }})
```

This will generate the following GraphQL query:

Expand All @@ -121,17 +121,17 @@ query Comments($postId: ID!, $deleted: Boolean!) {
content
postId
userId

user {
id
email
}

post {
id
content
title

user {
id
email
Expand Down Expand Up @@ -160,20 +160,20 @@ recommend the usage of async/await.
export default {
// Use a computed property for the component state to keep it reactive
computed: {
post: () => Post.find(1)
post: () => Post.find('1')
},
created () {
// fetch the data when the view is created and the data is
// already being observed
this.fetchData();
},
watch: {
// call again the method if the route changes
'$route': 'fetchData'
},
methods: {
// Loads the data from the server and stores them in the Vuex Store.
async fetchData () {
Expand All @@ -191,7 +191,7 @@ The plugin caches same queries. To bypass caching set the second param of the `f
when using the convenience method or add `bypassCache: true` to the arguments of the `dispatch()` call

```javascript
await Comment.fetch({ id: 42 }, true );
await Comment.fetch({ id: '42' }, true );
// Or
await Comment.dispatch('fetch', { filter: { id: 42 }, bypassCache: true })
await Comment.dispatch('fetch', { filter: { id: '42' }, bypassCache: true })
```
6 changes: 3 additions & 3 deletions docs/guide/persist.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ Variables:
```json
{
"post": {
"id": 42,
"userId": 15,
"id": "42",
"userId": "15",
"content": "Lorem Ipsum dolor sit amet",
"title": "Example Post",
"user": {
"id": 15,
"id": "15",
"email": "[email protected]"
}
}
Expand Down
10 changes: 5 additions & 5 deletions docs/guide/push.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ Variables:

```json
{
"id": 42,
"id": "42",
"post": {
"id": 42,
"userId": 15,
"id": "42",
"userId": "15",
"content": "Some more exciting content!",
"title": "Not a example post",
"user": {
"id": 15,
"id": "15",
"email": "[email protected]"
}
}
Expand All @@ -58,7 +58,7 @@ Like when persisting, all records which are returned replace the respective exis
## Additional variables

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


## Relationships
Expand Down
Loading

0 comments on commit 72fa4b3

Please sign in to comment.