Feature Request: Add API Call Support from API File (Similar to RTK initiate)
Description
Currently, there is no option to call an API directly from the API file, similar to Redux Toolkit Query's initiate method.
It would be helpful to have a way to trigger API requests programmatically without relying on hooks. This is useful for scenarios such as:
- Calling APIs from utility functions
- Server-side logic
- Background tasks
- Middleware
- Non-React environments
Expected Behavior
Provide a method similar to RTK Query's initiate, allowing developers to call an endpoint directly from the API definition.
Example
await api.endpoints.getUser.initiate({ id: 1 });
or an equivalent API supported by the library.
Benefits
- Enables programmatic API calls.
- Improves flexibility for non-component use cases.
- Provides a familiar developer experience for users migrating from RTK Query.
Feature Request: Add API Call Support from API File (Similar to RTK
initiate)Description
Currently, there is no option to call an API directly from the API file, similar to Redux Toolkit Query's
initiatemethod.It would be helpful to have a way to trigger API requests programmatically without relying on hooks. This is useful for scenarios such as:
Expected Behavior
Provide a method similar to RTK Query's
initiate, allowing developers to call an endpoint directly from the API definition.Example
or an equivalent API supported by the library.
Benefits