mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 11:34:26 +00:00
6c09e7160a
* add exports to config saga, refactor * add config saga tests * add exports to necessary files * add remaining saga test & snapshots * update orders saga spec to use Infinity constant * update dWallet saga spec snapshot * refactor config saga slightly * update config saga spec * update config saga snapshot * update rates saga spec * remove unused vars from config saga spec
25 lines
632 B
TypeScript
25 lines
632 B
TypeScript
import {
|
|
closeNotification,
|
|
ShowNotificationAction
|
|
} from 'actions/notifications';
|
|
import { delay, SagaIterator } from 'redux-saga';
|
|
import { call, put, takeEvery } from 'redux-saga/effects';
|
|
|
|
export function* handleNotification(
|
|
action: ShowNotificationAction
|
|
): SagaIterator {
|
|
const { duration } = action.payload;
|
|
// show forever
|
|
if (duration === 0 || duration === Infinity) {
|
|
return;
|
|
}
|
|
|
|
// FIXME
|
|
yield call(delay, duration || 5000);
|
|
yield put(closeNotification(action.payload));
|
|
}
|
|
|
|
export default function* notificationsSaga(): SagaIterator {
|
|
yield takeEvery('SHOW_NOTIFICATION', handleNotification);
|
|
}
|