mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-09 18:45:38 +00:00
da93fb1684
* Add repo wide prettier command to prepush * Make config file explict, remove formatAll to prepush
20 lines
624 B
TypeScript
20 lines
624 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);
|
|
}
|