Skip to content

Commit 0dcd6c2

Browse files
committed
change call to apply to pass this context to custom apiClient implementations
1 parent 206a54f commit 0dcd6c2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/sagas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function* _apiGeneric(action: CrudAction<any>): Generator<Effect, void, any> {
3535
}
3636

3737
try {
38-
const response = yield call(apiClient[method], path, { params, data, fetchConfig })
38+
const response = yield call([apiClient, apiClient[method]], path, { params, data, fetchConfig })
3939
yield put({ meta, type: success, payload: response })
4040
} catch (error) {
4141
yield put({ meta, type: failure, payload: error, error: true })

test/sagas.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('apiGeneric', () => {
6666
const gen = apiGeneric(apiClient)(fetchWidgets(1))
6767
const apiCall = gen.next().value
6868
expect(apiCall).toEqual(
69-
call(apiClient.get, '/widgets', {
69+
call([apiClient, apiClient.get], '/widgets', {
7070
params: { page: 1 },
7171
data: undefined,
7272
fetchConfig: undefined

0 commit comments

Comments
 (0)