mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-07 08:43:43 +00:00
1221a73a46
* Change navigator.onLine to actually pinging the network. Refactor notifications to take Infinity instead of 'infinity' * Stop polling when forced offline. * Show spinners if unit display balance is null, show offline text if were actually offline. * Fix issue with typescript and connected union-prop components. * Only ping the node when navigator.onLine changes.
23 lines
621 B
TypeScript
23 lines
621 B
TypeScript
import {
|
|
closeNotification,
|
|
ShowNotificationAction
|
|
} from 'actions/notifications';
|
|
import { delay, SagaIterator } from 'redux-saga';
|
|
import { call, put, takeEvery } from 'redux-saga/effects';
|
|
|
|
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);
|
|
}
|