Files
planka/client/src/sagas/app/services/notifications.js
T
2019-08-31 04:07:25 +05:00

19 lines
651 B
JavaScript

import { call, put, select } from 'redux-saga/effects';
import { deleteNotificationsRequest } from '../requests';
import { notificationIdsForCurrentCardSelector } from '../../../selectors';
import { deleteNotifications } from '../../../actions';
export function* deleteNotificationsService(ids) {
yield put(deleteNotifications(ids));
yield call(deleteNotificationsRequest, ids);
}
export function* deleteNotificationsInCurrentCardService() {
const notificationIds = yield select(notificationIdsForCurrentCardSelector);
if (notificationIds && notificationIds.length > 0) {
yield call(deleteNotificationsService, notificationIds);
}
}