How to use the @talend/react-cmf.actions.http function in @talend/react-cmf

To help you get started, we’ve selected a few @talend/react-cmf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Talend / ui / packages / generator / generators / react-cmf / templates / src / app / actions / dataset.js View on Github external
export function fetchDataSets() {
	/**
	 * CMF actions.http is an action creator that will dispatch an http action.
	 * This action will be caught and executed by the CMF http middleware
	 */
	return actions.http.get('/datasets.json', {
		// action type to dispatch before fetch
		onSend: GETTING_DATASETS,
		// action type to dispatch on fetch error
		onError: ERROR_GETTING_DATASETS,
		// CMF action config
		// collectionId is the key where the result will be stored in app state
		cmf: {
			collectionId: 'datasets',
		},
		// data adaptation before being dispatched
		transform(data) {
			return data.map((row) => {
				const { datastore, ...rest } = row;
				return {
					datastore: datastore.label,
					...rest,
github Talend / ui / packages / generator / generators / react-cmf / templates / src / app / actions / datastore.js View on Github external
export function fetchDataStores() {
	/**
	 * CMF actions.http is an action creator that will dispatch an http action.
	 * This action will be caught and executed by the CMF http middleware
	 */
	return actions.http.get('/datastores.json', {
		// action type to dispatch before fetch
		onSend: GETTING_DATASTORES,
		// action type to dispatch on fetch error
		onError: ERROR_GETTING_DATASTORES,
		// CMF action config
		// collectionId is the key where the result will be stored in app state
		cmf: {
			collectionId: 'datastores',
		},
	});
}
github Talend / ui / packages / containers / .storybook / config.js View on Github external
function httpPhotosGet1() {
	return actions.http.get('https://jsonplaceholder.typicode.com/photos/', {
		cmf: {
			collectionId: 'photos1',
		},
	});
}
function httpPhotosGet2() {
github Talend / data-prep / dataprep-webapp / src / app / next / sagas / preparation.saga.js View on Github external
function* fetchPreparations() {
	while (true) {
		const { folderId = 'Lw==' } = yield take(FETCH_PREPARATIONS);
		yield put(
			actions.http.get(`http://localhost:8888/api/folders/${folderId}/preparations`, {
				cmf: {
					collectionId: 'preparations',
				},
				transform({ folders, preparations }) {
					const adaptedFolders = folders.map(folder => ({
						author: folder.ownerId,
						className: 'list-item-folder',
						icon: 'talend-folder',
						id: folder.id,
						name: folder.name,
						type: 'folder',
					}));
					const adaptedPreparations = preparations.map(prep => ({
						author: prep.author,
						className: 'list-item-preparation',
						datasetName: prep.dataset && prep.dataset.dataSetName,