mvp of request effect
This commit is contained in:
parent
eaa9ac392c
commit
35498bf7ab
|
@ -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…
Reference in New Issue