Update selected item color in Pass menu
[ProtonMail-WebClient.git] / packages / pass / store / sagas / monitor / monitor-address.resolve.saga.ts
blob558a2bbc97ba1d06a866bfd6d05581f575c3ad9a
1 import { put } from 'redux-saga/effects';
3 import {
4     setBreachedAliasResolved,
5     setBreachedCustomEmailResolved,
6     setBreachedProtonAddressResolved,
7 } from '@proton/pass/lib/monitor/monitor.request';
8 import { AddressType } from '@proton/pass/lib/monitor/types';
9 import { getAliasBreach, getCustomBreach, getProtonBreach, resolveAddressMonitor } from '@proton/pass/store/actions';
10 import { createRequestSaga } from '@proton/pass/store/request/sagas';
12 export default createRequestSaga({
13     actions: resolveAddressMonitor,
14     call: function* (address) {
15         switch (address.type) {
16             case AddressType.ALIAS: {
17                 yield setBreachedAliasResolved(address.shareId, address.itemId);
18                 yield put(getAliasBreach.intent(address));
19                 return address;
20             }
22             case AddressType.CUSTOM: {
23                 yield setBreachedCustomEmailResolved(address.addressId);
24                 yield put(getCustomBreach.intent(address.addressId));
25                 return address;
26             }
28             case AddressType.PROTON: {
29                 yield setBreachedProtonAddressResolved(address.addressId);
30                 yield put(getProtonBreach.intent(address.addressId));
31                 return address;
32             }
33         }
34     },
35 });