Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
yield takeLatest(SEARCH_RESET, function* () {
yield put(actions.collections.addOrReplace('search', null));
});
}
export function* fetch() {
const data = yield store.get('settings');
yield put(actions.collections.addOrReplace('settings', data));
}
const providers = Object.keys(categories);
const service = new SearchService(categories);
const batches = providers.map(
provider => service.build(
provider,
payload,
)
);
const results = (
yield all(batches.map(request => call(...request)))
).map(
(result, index) => service.transform(providers[index], result)
);
yield put(Typeahead.setStateAction({ searching: false }, 'headerbar:search'));
yield put(actions.collections.addOrReplace(
'search',
[].concat(...results).filter(s => s.suggestions.length),
));
}
function* sagaPhotoGet3() {
const answer = yield call(sagas.http.get, 'https://jsonplaceholder.typicode.com/photos/');
yield put(actions.collections.addOrReplace('photos3', answer.data));
}
function* setTitleEditionMode() {
while (true) {
const { payload } = yield take(SET_TITLE_EDITION_MODE);
const preparations = yield select(state => state.cmf.collections.get('preparations'));
const updated = preparations.update(
preparations.findIndex(val => val.get('id') === payload),
val => val.set('display', 'input'),
);
yield put(actions.collections.addOrReplace('preparations', updated));
}
}
export function* create(payload) {
const folderId = (payload && payload.folderId) || DEFAULT_FOLDER_ID;
yield put(actions.collections.addOrReplace('currentFolderId', folderId));
const uris = yield select(state => state.cmf.collections.getIn(['settings', 'uris']));
const response = yield call(
http.post,
`${uris.get('apiPreparations')}?folder=${folderId}`,
{
dataSetId: payload.id || payload.datasetId || payload.model.id,
},
);
if (!(response instanceof Error)) {
const preparationId = response.data;
yield put({
type: REDIRECT_WINDOW,
payload: { url: `/#/playground/preparation?prepid=${preparationId}` },
});
}
}
function* fetchSettings() {
const { data } = yield call(http.get, '/api/settings');
yield put(actions.collections.addOrReplace('settings', data));
}