Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function* testCancel(): SagaIterator {
yield cancel()
// typings:expect-error
yield cancel(undefined)
// typings:expect-error
yield cancel({})
yield cancel(task)
// typings:expect-error
yield cancel(task, task)
yield cancel([task, task])
yield cancel([task, task, task])
const tasks: Task[] = []
yield cancel(tasks)
export function* loadWebhook() {
const watcher = yield takeLatest(LOAD_WEBHOOK, getWebhook);
// Suspend execution until location changes
yield take(LOCATION_CHANGE);
yield cancel(watcher);
}
export function* testFunctionSaga() {
const watcher = yield takeLatest(TEST_FUNCTION_REQUEST, testFunction);
// Suspend execution until location changes
yield take(LOCATION_CHANGE);
yield cancel(watcher);
}
const token = yield select(makeSelectToken());
const { ProfileImage, ProfileImage1, ...data } = action.payload;
// const files = {ProfileImage, ProfileImage1};
const files = [ProfileImage, ProfileImage1];
yield fork(
Api.multipartPost(
'org',
actions.addEditSuccess,
actions.addEditFailure,
data,
files,
token,
),
);
yield take([LOCATION_CHANGE, types.ADD_EDIT_FAILURE]);
yield cancel(successWatcher);
}
function* addEdit() {
const sucessWatcher = yield fork(redirectOnSuccess);
const token = yield select(makeSelectToken());
const data = yield select(makeSelectOne());
yield fork(
Api.post(
`faq/cat`,
actions.addEditSuccess,
actions.addEditFailure,
data,
token,
),
);
yield take([LOCATION_CHANGE, types.ADD_EDIT_FAILURE]);
yield cancel(sucessWatcher);
}
function* deleteCat(action) {
try {
const channelMap = ((yield call(ChatTypes.localDownloadFileAttachmentLocalRpcChannelMapOld, channelConfig, {param})): any)
const progressTask = yield Saga.effectOnChannelMap(c => Saga.safeTakeEvery(c, function * ({response}) {
const {bytesComplete, bytesTotal} = response.param
yield put(Creators.downloadProgress(conversationIDKey, messageID, loadPreview || isHdPreview, bytesComplete, bytesTotal))
response.result()
}), channelMap, 'chat.1.chatUi.chatAttachmentDownloadProgress')
const start = yield Saga.takeFromChannelMap(channelMap, 'chat.1.chatUi.chatAttachmentDownloadStart')
start.response.result()
const done = yield Saga.takeFromChannelMap(channelMap, 'chat.1.chatUi.chatAttachmentDownloadDone')
done.response.result()
yield cancel(progressTask)
Saga.closeChannelMap(channelMap)
yield put(Creators.attachmentLoaded(conversationIDKey, messageID, filename, loadPreview, isHdPreview))
} catch (err) {
yield put(Creators.attachmentLoaded(conversationIDKey, messageID, null, loadPreview, isHdPreview))
}
}
export function* defaultSaga() {
const loadConfigWatcher = yield fork(takeLatest, CONFIG_FETCH, fetchConfig);
const loadLanguagesWatcher = yield fork(takeLatest, LANGUAGES_FETCH, fetchLanguages);
const editConfigWatcher = yield fork(takeLatest, EDIT_SETTINGS, settingsEdit);
const postLanguageWatcher = yield fork(takeLatest, NEW_LANGUAGE_POST, postLanguage);
const deleteLanguageWatcher = yield fork(takeLatest, LANGUAGE_DELETE, deleteLanguage);
const loadDatabasesWatcher = yield fork(takeLatest, DATABASES_FETCH, fetchDatabases);
const postDatabaseWatcher = yield fork(takeLatest, NEW_DATABASE_POST, postDatabase);
const deleteDatabaseWatcher = yield fork(takeLatest, DATABASE_DELETE, deleteDatabase);
const fetchSpecificDatabaseWatcher = yield fork(takeLatest, SPECIFIC_DATABASE_FETCH, fetchSpecificDatabase);
const editDatabaseWatcher = yield fork(takeLatest, DATABASE_EDIT, editDatabase);
yield take(LOCATION_CHANGE);
yield cancel(loadConfigWatcher);
yield cancel(loadLanguagesWatcher);
yield cancel(editConfigWatcher);
yield cancel(postLanguageWatcher);
yield cancel(deleteLanguageWatcher);
yield cancel(loadDatabasesWatcher);
yield cancel(postDatabaseWatcher);
yield cancel(deleteDatabaseWatcher);
yield cancel(fetchSpecificDatabaseWatcher);
yield cancel(editDatabaseWatcher);
}
export function* defaultSaga() {
const loadDataWatcher = yield fork(takeLatest, FETCH_DATA, dataFetch);
yield fork(takeLatest, DELETE_DATA, dataDelete);
yield fork(takeLatest, SUBMIT, submitData);
yield take(LOCATION_CHANGE);
yield cancel(loadDataWatcher);
}
export function* defaultSaga() {
const loadConfigWatcher = yield fork(takeLatest, CONFIG_FETCH, fetchConfig);
const loadLanguagesWatcher = yield fork(takeLatest, LANGUAGES_FETCH, fetchLanguages);
const editConfigWatcher = yield fork(takeLatest, EDIT_SETTINGS, settingsEdit);
const postLanguageWatcher = yield fork(takeLatest, NEW_LANGUAGE_POST, postLanguage);
const deleteLanguageWatcher = yield fork(takeLatest, LANGUAGE_DELETE, deleteLanguage);
const loadDatabasesWatcher = yield fork(takeLatest, DATABASES_FETCH, fetchDatabases);
yield take(LOCATION_CHANGE);
yield cancel(loadConfigWatcher);
yield cancel(loadLanguagesWatcher);
yield cancel(editConfigWatcher);
yield cancel(postLanguageWatcher);
yield cancel(deleteLanguageWatcher);
yield cancel(loadDatabasesWatcher);
}
const name = yield select(makeSelectName());
const gender = yield select(makeSelectGender());
const data = { email, password, password2: password, name, gender };
const errors = validate(data);
if (errors.isValid) {
const successWatcher = yield fork(redirectOnSuccess, action.redirect);
yield fork(
Api.post(
'user/register',
actions.signupSuccess,
actions.signupFailure,
data,
),
);
yield take([LOCATION_CHANGE, types.SIGNUP_FAILURE]);
yield cancel(successWatcher);
} else {
yield put(actions.setStoreValue({ key: 'errors', value: errors.errors }));
}
}