Update selected item color in Pass menu
[ProtonMail-WebClient.git] / packages / pass / store / sagas / alias / alias-details-request.saga.ts
blob8e7f38c0fc3e2bb69bdb800492565f9c07ba8e57
1 import { put, takeEvery } from 'redux-saga/effects';
3 import { getAliasDetails } from '@proton/pass/lib/alias/alias.requests';
4 import { getAliasDetailsFailure, getAliasDetailsIntent, getAliasDetailsSuccess } from '@proton/pass/store/actions';
5 import type { AliasDetails } from '@proton/pass/types';
7 function* requestAliasDetails(action: ReturnType<typeof getAliasDetailsIntent>) {
8     const {
9         payload: { shareId, itemId, aliasEmail },
10         meta: { request },
11     } = action;
12     try {
13         const result: AliasDetails = yield getAliasDetails(shareId, itemId);
14         yield put(getAliasDetailsSuccess(request.id, result));
15     } catch (e) {
16         yield put(getAliasDetailsFailure(request.id, { aliasEmail }, e));
17     }
20 export default function* watcher() {
21     yield takeEvery(getAliasDetailsIntent.match, requestAliasDetails);