Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function* getTrialsListOfJob(action) {
try {
// Get Trials list and display notification
yield put(showLoading())
const token = yield select(getToken)
yield call(getJobsList, action)
console.log("Getting Trials List of Job")
const trialsList = yield call(api.requestTrialsOfJob, {}, token, action.app, action.appVersion)
yield put(actions.populateTrialsToJobs(trialsList.data, action.app, action.appVersion))
yield put(hideLoading())
} catch(e) {
console.error(e.response)
console.error(e)
yield put(notificationShow("Failed to Fetch TrialsList"))
}
}
function* createDataset(action) {
const {name, task, file, dataset_url} = action
try {
yield put(showLoading())
const token = yield select(getToken)
yield call(api.postCreateDataset, name, task, file, dataset_url, token)
console.log("Create Dataset success")
yield alert("Create Dataset success")
yield put(notificationShow("Create Dataset Success")); // no need to write test for this
yield(push('console/datasets/list-dataset'))
yield put(hideLoading())
} catch(e) {
console.error(e.response)
console.error(e)
console.error(e.response.data)
yield put(notificationShow("Failed to Create Dataset"));
}
}
function* loadRoles() {
try {
yield put(resetLoading());
yield put(showLoading());
const roles = yield call(api, 'roles');
yield put({
type: ROLES_LOADED,
payload: {
roles,
},
});
} catch (error) {
const errorMessage = yield ApiError.errorToHumanString(error);
yield put(setErrorMessage(errorMessage));
} finally {
yield put(hideLoading());
if (yield cancelled()) {
// do a thing
}
}
function* deleteContent({ payload: { content } }) {
try {
yield put(resetLoading());
yield put(showLoading());
yield call(api, 'node:delete', { parameters: { node: content } });
} catch (error) {
const errorMessage = yield ApiError.errorToHumanString(error);
yield put(setErrorMessage(errorMessage));
} finally {
yield put(hideLoading());
}
}
function* loadUser(action) {
const {
payload: { uid },
} = action;
try {
yield put(resetLoading());
yield put(showLoading());
const {
data: [user],
} = yield call(api, 'user', {
queryString: {
filter: { condition: { path: 'uid', value: uid } },
},
});
yield put({
type: USER_LOADED,
payload: {
user,
},
});
} catch (error) {
const showLoadingBar = () => {
if (showProgressBar) {
dispatch(showLoading(progressBarTarget));
}
};
},
},
}),
{
severityGroup: {
group: {
conjunction: 'OR',
},
},
},
)
: {}),
},
};
yield put(resetLoading());
yield put(showLoading());
yield put({
type: DBLOG_FILTER_UPDATED,
payload: {
options,
},
});
const dbLogEntriesTypes = yield call(api, 'dblog:types');
const dbLogEntries = yield call(api, 'dblog', { queryString });
yield put({
type: DBLOG_COLLECTION_LOADED,
payload: {
dbLogEntries,
dbLogEntriesTypes,
},
});
} catch (error) {
function* loadSingleContent(action) {
const {
payload: { nid },
} = action;
try {
yield put(resetLoading());
yield put(showLoading());
const {
data: [content],
} = yield call(api, 'content', {
queryString: {
filter: { condition: { path: 'nid', value: nid } },
},
});
yield put({
type: CONTENT_SINGLE_LOADED,
payload: {
content,
},
});
} catch (error) {
function* editUser({payload}) {
try {
yield put(showLoading());
yield put(userLoading());
const submitResult = yield call(changeUserInfo, payload);
yield put(userFetchSuccess(submitResult));
} catch (e) {
yield put(userFetchFailed(e.data));
} finally {
yield put(hideLoading());
}
}
return new Promise((resolve) => {
props.dispatch(showLoading());
setTimeout(() => {
props.dispatch(hideLoading());
resolve(props);
}, 1000);
});
}