Skip to content

Commit d36b0d8

Browse files
committed
Use shortcut for invalidate tags with typings
1 parent 44d0c08 commit d36b0d8

File tree

1 file changed

+4
-4
lines changed
  • packages/webapp/src/containers/Task

1 file changed

+4
-4
lines changed

packages/webapp/src/containers/Task/saga.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ import {
107107
getMovementTaskBody,
108108
getSoilSampleTaskBody,
109109
} from './sagaUtils';
110-
import { api } from '../../store/api/apiSlice';
110+
import { invalidateTags } from '../../store/api/apiSlice';
111111

112112
const taskTypeEndpoint = [
113113
'cleaning_task',
@@ -665,7 +665,7 @@ export function* createTaskSaga({ payload }) {
665665
task_translation_key === 'HARVEST_TASK' ? result.data[0] : result.data;
666666
yield call(getTasksSuccessSaga, { payload: isHarvest ? result.data : [result.data] });
667667
if (task_translation_key === 'IRRIGATION_TASK') {
668-
yield put(api.util.invalidateTags(['IrrigationPrescriptions']));
668+
yield put(invalidateTags(['IrrigationPrescriptions']));
669669
}
670670
if (alreadyCompleted) {
671671
if (['CLEANING_TASK', 'PEST_CONTROL_TASK'].includes(task_translation_key)) {
@@ -868,7 +868,7 @@ export function* completeTaskSaga({ payload: { task_id, data, returnPath } }) {
868868
});
869869

870870
if (task_translation_key === 'MOVEMENT_TASK') {
871-
yield put(api.util.invalidateTags(['Animals', 'AnimalBatches']));
871+
yield put(invalidateTags(['Animals', 'AnimalBatches']));
872872
}
873873
}
874874
} catch (e) {
@@ -1017,7 +1017,7 @@ export function* deleteTaskSaga({ payload: data }) {
10171017
}
10181018
yield put(deleteTaskSuccess(result.data));
10191019
if (task_type.task_translation_key === 'IRRIGATION_TASK') {
1020-
yield put(api.util.invalidateTags(['IrrigationPrescriptions']));
1020+
yield put(invalidateTags(['IrrigationPrescriptions']));
10211021
}
10221022
yield put(enqueueSuccessSnackbar(i18n.t('TASK.DELETE.SUCCESS')));
10231023
}

0 commit comments

Comments
 (0)