Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const createNewTemplate = () => dispatch => {
const newTemplate = Map({
id: shortid.generate(),
name: 'no name',
mjml: defaultContent,
html: mjml2html(defaultContent),
creationDate: new Date()
})
dispatch(setTemplate(newTemplate))
dispatch(saveTemplate())
dispatch(push('editor'))
}
export const saveTemplate = () => (dispatch, getState) => {
const state = getState()
const { template, config } = state
const html = mjml2html(template.get('mjml'))
save(
template.set('html', html),
config.get('projectDirectory')
)
}