Initial commit

This commit is contained in:
Maksim Eltyshev
2019-08-31 04:07:25 +05:00
commit 5ffef61fe7
613 changed files with 91659 additions and 0 deletions
@@ -0,0 +1,67 @@
import { call, put } from 'redux-saga/effects';
import request from './request';
import {
createCardLabelFailed,
createCardLabelRequested,
createCardLabelSucceeded,
deleteCardLabelFailed,
deleteCardLabelRequested,
deleteCardLabelSucceeded,
} from '../../../actions';
import api from '../../../api';
export function* createCardLabelRequest(cardId, labelId) {
yield put(
createCardLabelRequested({
cardId,
labelId,
}),
);
try {
const { item } = yield call(request, api.createCardLabel, cardId, {
labelId,
});
const action = createCardLabelSucceeded(item);
yield put(action);
return {
success: true,
payload: action.payload,
};
} catch (error) {
const action = createCardLabelFailed(error);
yield put(action);
return {
success: false,
payload: action.payload,
};
}
}
export function* deleteCardLabelRequest(cardId, labelId) {
yield put(deleteCardLabelRequested(cardId, labelId));
try {
const { item } = yield call(request, api.deleteCardLabel, cardId, labelId);
const action = deleteCardLabelSucceeded(item);
yield put(action);
return {
success: true,
payload: action.payload,
};
} catch (error) {
const action = deleteCardLabelFailed(cardId, labelId, error);
yield put(action);
return {
success: false,
payload: action.payload,
};
}
}