Use API Facade instead of request url
See original GitHub issueIn my project, I use API Facades to fetch data and saga looks like
export const handleGetItem: Saga = function*({
payload,
}: PayloadAction<typeof ActionEnum.API_GET_REQUEST, Payload>): IterableIterator<any> {
const { id }: Payload = payload;
const facade: Facade = yield getContext(SagaContextEnum.facade);
try {
const storeItem: IItem = yield call(() => facade.getItem(id));
yield put(actions.successGetItem(storeItem));
} catch (err) {
yield put(actions.errorGetItem(err));
}
};
How can I pass facade.getItem(id)
to the redux-saga-request action creator??
Is it possible to implement this feature in this library??
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Use API Facade instead of request url · Issue #270
In my project, I use API Facades to fetch data and saga looks like export const handleGetItem: Saga = function*({ payload, } ...
Read more >API Facade Pattern
Implementing an API façade pattern involves three basic steps. 1 - Design the ideal API – design the URLs, request parameters and responses,....
Read more >Implement a Custom API for a Façade REST Service
To create a complete custom API using Oracle Mobile Hub. ... with the New API button. Click the API you already created, or...
Read more >Why REST Api do not follow the Facade design pattern
I think objects are only built correctly around coherent behaviors and not around data. I will provoke and say that data is almost ......
Read more >Unlocking Data from Existing Systems with a Serverless ...
When building modern APIs for existing systems, you can use an architecture pattern called API Facade. This pattern creates a layer that exposes ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@strdr4605 I am surprised as
does not show any TS errors.
Anyway, I am closing this issue in favour of #244
@strdr4605 of course, if you dispatch request action like
yield put(getItems(id))
, then id can be fromyield select
( I know you mentioned u dont wanna have id in action payload, for this see below methods)personally though, If I had some id which is part of many request actions, I would just use redux thunk, which makes your sagas clean, or works if you dispatch actions from react too:
In my apps I sometimes do also another thing, kind of magical but I find it very convenient:
By using request interceptor, I can then define actions like: