Skip to content

Commit 07deb29

Browse files
Correct that resolved value is the full response
1 parent 0f196a8 commit 07deb29

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/reading-data.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
## all
44

5-
To retrieve all of the records for a resource, call the `all()` method. The method returns a promise that will resolve to the records:
5+
To retrieve all of the records for a resource, call the `all()` method. The method returns a promise that will resolve to the server's JSON response:
66

77
```javascript
8-
resource.all().then(widgets => console.log(widgets));
8+
resource.all().then(response => console.log(response.data));
99
```
1010

1111
## find
1212

1313
To retrieve a single record by ID, call the `find()` method:
1414

1515
```javascript
16-
resource.find({ id: 42 }).then(widget => console.log(widget));
16+
resource.find({ id: 42 }).then(response => console.log(response.data));
1717
```
1818

1919
## where
@@ -24,7 +24,7 @@ To filter/query for records based on certain criteria, use the `where` method, p
2424
const filter = {
2525
category: 'whizbang',
2626
};
27-
resource.where({ filter }).then(widgets => console.log(widgets));
27+
resource.where({ filter }).then(response => console.log(response.data));
2828
```
2929

3030
## related
@@ -37,7 +37,7 @@ const parent = {
3737
id: 27,
3838
};
3939

40-
resource.related({ parent }).then(widgets => console.log(widgets));
40+
resource.related({ parent }).then(response => console.log(response.data));
4141
```
4242

4343
By default, the name of the relationship on `parent` is assumed to be the same as the name of the other model: in this case, `widgets`. In cases where the names are not the same, you can explicitly pass the relationship name:
@@ -52,7 +52,7 @@ const relationship = 'purchased-widgets';
5252

5353
resource
5454
.related({ parent, relationship })
55-
.then(widgets => console.log(widgets));
55+
.then(response => console.log(response.data));
5656
```
5757

5858
## Options

0 commit comments

Comments
 (0)