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 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,
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',
},
});
}
function httpPhotosGet1() {
return actions.http.get('https://jsonplaceholder.typicode.com/photos/', {
cmf: {
collectionId: 'photos1',
},
});
}
function httpPhotosGet2() {
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,