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"))
}
}
// Get the content types from the redux state
const contentTypes = yield select(contentTypesSelector);
// Extract the content type from the content data
const contentType = extractContentType(content);
// Map the content type to the human-readable name
const contentName =
mapContentTypeToName(contentTypes, contentType) || 'unknown';
yield put(push('/admin/content'));
yield put(setSuccessMessage(`New ${contentName} added successfully`));
} catch (error) {
const errorMessage = yield ApiError.errorToHumanString(error);
yield put(setErrorMessage(errorMessage));
} finally {
yield put(hideLoading());
}
}
},
method: 'PATCH',
},
);
yield put(setMessage('Changes have been saved', MESSAGE_SUCCESS));
yield put({
type: SIMPLE_CONFIG_POSTED,
payload: {
name,
config,
},
});
} catch (error) {
yield put(setMessage(error.toString()));
} finally {
yield put(hideLoading());
if (yield cancelled()) {
// do a thing
}
}
}
.then(content => {
dispatch(hideLoading())
return dispatch(receiveArticle(content, id))
})
.catch(error => console.info('request error: ', error))
export function* postTrainJob(action) {
try {
yield put(showLoading())
const token = yield select(getToken)
yield call(api.postCreateTrainJob, action.json, token)
yield put(notificationShow("Create TrainJob success"))
yield put(hideLoading())
yield put(push('/console/jobs/list-train-jobs'))
} catch (e) {
yield call(alert, e.response.data)
console.error(e.response)
console.error(e)
yield put(notificationShow("fail to Create TrainJob"))
}
}
if (!Object.keys(queryString.filter).length) {
delete queryString.filter;
}
const contentList = yield call(api, 'content', { queryString });
yield put({
type: CONTENT_LOADED,
payload: {
contentList,
},
});
} catch (error) {
const errorMessage = yield ApiError.errorToHumanString(error);
yield put(setErrorMessage(errorMessage));
} finally {
yield put(hideLoading());
}
}
setTimeout(() => {
props.dispatch(hideLoading());
reject(props);
}, 1000);
});
function* fetchGuys() {
try {
yield take(actionTypes.SAY_HELLO)
yield put(showLoading())
const json = yield call(fetchData, 'https://jimmylv.github.io/api/guys.json')
yield put({ type: actionTypes.SAY_HELLO_DONE, payload: json })
} catch (err) {
yield put({ type: actionTypes.SAY_HELLO_ERROR, payload: err })
} finally {
yield put(hideLoading())
}
}
const hideLoadingBar = () => {
if (showProgressBar) {
dispatch(hideLoading(progressBarTarget));
}
};
takeEvery('END_LOADING', function *() {
yield put(hideLoading())
})
])