1 import { put, takeEvery } from 'redux-saga/effects';
3 import { getAliasOptions } from '@proton/pass/lib/alias/alias.requests';
4 import { getAliasOptionsFailure, getAliasOptionsIntent, getAliasOptionsSuccess } from '@proton/pass/store/actions';
5 import type { AliasOptions } from '@proton/pass/types';
7 function* requestAliasOptions(action: ReturnType<typeof getAliasOptionsIntent>) {
10 meta: { callback: onAliasOptionsIntentProcessed, request },
14 const options: AliasOptions = yield getAliasOptions(shareId);
15 const aliasOptionsSuccessAction = getAliasOptionsSuccess(request.id, { options });
16 yield put(aliasOptionsSuccessAction);
17 onAliasOptionsIntentProcessed?.(aliasOptionsSuccessAction);
19 const aliasOptionsFailureAction = getAliasOptionsFailure(request.id, e);
20 yield put(aliasOptionsFailureAction);
21 onAliasOptionsIntentProcessed?.(aliasOptionsFailureAction);
25 export default function* watcher() {
26 yield takeEvery(getAliasOptionsIntent.match, requestAliasOptions);