Update selected item color in Pass menu
[ProtonMail-WebClient.git] / packages / pass / store / sagas / items / item-move.saga.ts
blobb7067741360ef6999c54817b7a1d77fb62c0ded3
1 import { put, takeEvery } from 'redux-saga/effects';
3 import { moveItem } from '@proton/pass/lib/items/item.requests';
4 import { itemMoveFailure, itemMoveIntent, itemMoveSuccess } from '@proton/pass/store/actions';
5 import type { ItemRevision } from '@proton/pass/types';
7 function* itemCreationWorker({ payload }: ReturnType<typeof itemMoveIntent>) {
8     const { item: itemToMove, optimisticId, shareId } = payload;
10     try {
11         const item: ItemRevision = yield moveItem(itemToMove, itemToMove.shareId, shareId);
12         yield put(itemMoveSuccess({ item, optimisticId, shareId }));
13     } catch (e: unknown) {
14         yield put(itemMoveFailure({ optimisticId, shareId, item: itemToMove }, e));
15     }
18 export default function* watcher() {
19     yield takeEvery(itemMoveIntent.match, itemCreationWorker);