EndpointStoreclass
new EndpointStore<P, R>(endpoint: Endpoint<P, R>, payload: P, provider: APIProvider<P, R>)
| Param | Type | |
|---|---|---|
endpoint | Endpoint<P, R> | A typed API resource definition pairing a method and path with payload and result schemas. required |
payload | P | required |
provider | APIProvider<P, R> | Abstract base for API providers that send requests to a set of Endpoint definitions rooted at a common base URL. required |
| Return | |
|---|---|
EndpointStore<P, R> | Store that loads and tracks the result of calling a single API endpoint with a fixed payload, through an APIProvider. |
| Property | Type | |
|---|---|---|
.provider | APIProvider<P, R> | The API provider this store calls the endpoint through. required readonly |
.endpoint | Endpoint<P, R> | The endpoint this store calls to fetch its result. required readonly |
Store that loads and tracks the result of calling a single API endpoint with a fixed payload, through an APIProvider.
Examples
const store = new EndpointStore(endpoint, payload, provider); const result = await store; // R