From a4960858393f21b38ee66df9a10dec5843056da9 Mon Sep 17 00:00:00 2001 From: "Ben Scholzen (DASPRiD)" Date: Thu, 15 Feb 2024 16:04:45 +0100 Subject: [PATCH] fix: remove createPaginatedCollectionSelector from index export --- README.md | 14 ++++---------- src/index.ts | 1 - 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 185ea1d..337046a 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/src/index.ts b/src/index.ts index 6660f84..ea5d24e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,6 @@ export { createResourceSelector, createNullableResourceSelector, createResourceCollectionSelector, - createPaginatedCollectionSelector, createDataSelector, } from "./selector.ts"; export type { Relationships } from "./deserializer.ts";