mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 19:16:10 +00:00
mvp of request effect
This commit is contained in:
parent
eaa9ac392c
commit
35498bf7ab
14
common/sagas/helpers.ts
Normal file
14
common/sagas/helpers.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { delay as RDelay, SagaIterator } from 'redux-saga';
|
||||||
|
import { apply, all, call } from 'redux-saga/effects';
|
||||||
|
|
||||||
|
type Func1<T1> = (arg1: T1) => any;
|
||||||
|
|
||||||
|
export function* request<T1>(
|
||||||
|
context: any,
|
||||||
|
fn: Func1<T1>,
|
||||||
|
args: [T1],
|
||||||
|
delay: number = 500
|
||||||
|
): SagaIterator {
|
||||||
|
const [result] = yield all([apply(context, fn, args), call(RDelay, delay)]);
|
||||||
|
return result;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user