Skip to content

Commit e11b59c

Browse files
authored
docs: More udpates (#1176)
1 parent d55fe80 commit e11b59c

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

docs/getting-started/entity.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,14 @@ have shorthands of using object and array literals.
281281
Additionally, [Entities](../api/Entity.md) themselves can specify [nested](../guides/nested-response.md) [Entities](../api/Entity.md)
282282
by specifying a [static schema](../api/Entity.md#schema) member.
283283

284+
<Tabs
285+
defaultValue="Entity"
286+
values={[
287+
{ label: 'Entity', value: 'Entity' },
288+
{ label: 'Response', value: 'Response' },
289+
]}>
290+
<TabItem value="Entity">
291+
284292
```typescript
285293
import { Entity } from '@rest-hooks/endpoint';
286294

@@ -311,6 +319,25 @@ class User extends Entity {
311319
}
312320
```
313321

322+
</TabItem>
323+
<TabItem value="Response">
324+
325+
```json
326+
{
327+
"id": 5,
328+
"user": {
329+
"id": 10,
330+
"username": "bob",
331+
},
332+
"title": "Write some Entities",
333+
"completed": false
334+
}
335+
```
336+
337+
</TabItem>
338+
</Tabs>
339+
340+
314341
[Learn more](../guides/nested-response.md)
315342

316343
### Data Representations

docs/guides/auth.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ values={[
2121
<TabItem value="fetch">
2222

2323
```typescript
24-
class AuthdResource extends Resource {
24+
import { Resource } from '@rest-hooks/rest';
25+
26+
abstract class AuthdResource extends Resource {
2527
static getFetchInit = (init: RequestInit): RequestInit => ({
2628
...init,
2729
credentials: 'same-origin',
@@ -33,15 +35,17 @@ class AuthdResource extends Resource {
3335
<TabItem value="superagent">
3436

3537
```typescript
36-
import { Resource } from 'rest-hooks';
38+
import { Resource } from '@rest-hooks/rest';
3739
import type { SuperAgentRequest } from 'superagent';
3840

39-
class AuthdResource extends Resource {
41+
abstract class AuthdResource extends Resource {
4042
static fetchPlugin = (request: SuperAgentRequest) =>
4143
request.withCredentials();
4244
}
4345
```
4446

47+
If you used the [custom superagent fetch](../guides/custom-networking#superagent)
48+
4549
</TabItem>
4650
</Tabs>
4751

docs/guides/extending-endpoints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ and ensure the data is normalized and typed
254254
correctly via the [schema](../api/Endpoint#schema-schema) definition.
255255

256256
```typescript
257-
import { Resource } from 'rest-hooks';
257+
import { Resource } from '@rest-hooks/rest';
258258

259259
export default class BirthdayResource extends BaseResource {
260260
readonly id: string | undefined = undefined;

packages/legacy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#### `resources/ProfileResource.ts`
1919

2020
```typescript
21-
import { Resource } from 'rest-hooks';
21+
import { Resource } from '@rest-hooks/legacy';
2222

2323
export default class ProfileResource extends Resource {
2424
readonly id: number | undefined = undefined;

0 commit comments

Comments
 (0)