Skip to content

Commit

Permalink
fix: remove createPaginatedCollectionSelector from index export
Browse files Browse the repository at this point in the history
  • Loading branch information
DASPRiD committed Feb 15, 2024
1 parent a8416c4 commit a496085
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,11 @@ const articleSelector = createDataSelector(createResourceSelector(/* … */));
### Handling pagination

This library assumes that you never actually use the `links` properties in the JSON:API documents, but are primarily
interested in the pagination functionality for your own queries. For this you need to wrap the collection selector
with another selector:
interested in the pagination functionality for your own queries. Page params are automatically extracted by the
selector created through `createResourceCollectionSelector()`.

```typescript
import { createPaginatedCollectionSelector, createResourceSelector } from "jsonapi-zod-query";

const articlesSelector = createPaginatedCollectionSelector(createResourceCollectionSelector(/**/));
```

This will result in an object with a `data` and a `pageParams` property. The `pageParams` object will contain the
parameters defined in the links through the `first`, `prev`, `next` and `last` properties.
You can access the page parameters through the `pageParams` properties, which will contain the parameters defined in the
links through the `first`, `prev`, `next` and `last` properties.

You can pass these parameters to your query function. Before performing your fetch, you have to inject the parameters
into the URL again:
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export {
createResourceSelector,
createNullableResourceSelector,
createResourceCollectionSelector,
createPaginatedCollectionSelector,
createDataSelector,
} from "./selector.ts";
export type { Relationships } from "./deserializer.ts";

0 comments on commit a496085

Please sign in to comment.