Skip to content

Instantly share code, notes, and snippets.

@mb8z
Created October 16, 2020 11:36
Show Gist options
  • Save mb8z/3ea319e1addf42f3703bb795fe90182b to your computer and use it in GitHub Desktop.
Save mb8z/3ea319e1addf42f3703bb795fe90182b to your computer and use it in GitHub Desktop.
import Services from 'tripetto-services';
import { Export } from 'tripetto-runner-foundation';
import { run } from 'tripetto-runner-autoscroll';
const token = 'my-token-here';
const config = Services.init({ token });
// Picking params as spreaing the `config` does not work properly
const params = _.pick(config, ['definition', 'styles', 'l10n', 'locales', 'translations', 'attachments']);
const element = document.getElementById('my-tripetto-form');
run({
...params,
element,
onSubmit: (instance) => {
const { fields } = Export.exportables(instance);
const csv = Export.CSV(instance);
console.log('[Tripetto] Export.exportables.fields:', fields);
console.log('[Tripetto] Export.CSV:', csv);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment