|
@@ -180,6 +180,9 @@ export default {
|
|
|
const home = yield select(state => state.present.home);
|
|
const home = yield select(state => state.present.home);
|
|
|
const { data } = action;
|
|
const { data } = action;
|
|
|
const { collectionDashboards } = home;
|
|
const { collectionDashboards } = home;
|
|
|
|
|
+ if(collectionDashboards.findIndex(d => d.code === data.code) > -1) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
const res = yield call(service.fetch, {
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.DASHBOARD_COLLECT_ADD + '/' + data.code
|
|
url: URLS.DASHBOARD_COLLECT_ADD + '/' + data.code
|
|
|
});
|
|
});
|
|
@@ -198,11 +201,14 @@ export default {
|
|
|
const home = yield select(state => state.present.home);
|
|
const home = yield select(state => state.present.home);
|
|
|
const { data } = action;
|
|
const { data } = action;
|
|
|
const { collectionDashboards } = home;
|
|
const { collectionDashboards } = home;
|
|
|
|
|
+ let idx = collectionDashboards.findIndex(d => d.code === data.code);
|
|
|
|
|
+ if(idx === -1) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
const res = yield call(service.fetch, {
|
|
const res = yield call(service.fetch, {
|
|
|
url: URLS.DASHBOARD_COLLECT_REMOVE + '/' + data.code
|
|
url: URLS.DASHBOARD_COLLECT_REMOVE + '/' + data.code
|
|
|
});
|
|
});
|
|
|
if(res.code > 0) {
|
|
if(res.code > 0) {
|
|
|
- let idx = collectionDashboards.findIndex(d => d.code === data.code);
|
|
|
|
|
collectionDashboards.splice(idx, 1);
|
|
collectionDashboards.splice(idx, 1);
|
|
|
yield put({ type: 'setField', name: 'collectionDashboards', value: collectionDashboards });
|
|
yield put({ type: 'setField', name: 'collectionDashboards', value: collectionDashboards });
|
|
|
}else {
|
|
}else {
|