improvement: add a code split when event is fetched

The code for parsing HTML is isomorphic and runs on server as well.
Unfortunately it brings lot of dependencies and I will try to minimize
the initial load of the app.
This commit is contained in:
Ondřej Synáček 2020-12-25 14:40:23 +01:00
parent 0f7d57afa0
commit f052a66421
1 changed files with 8 additions and 4 deletions

View File

@ -21,7 +21,6 @@
</style>
<script>
import { createEvent } from '../actions'
import logger from '../services/logger'
export let error
@ -38,15 +37,20 @@
pending ? 'input--pending': '',
].join(' ')
const handleSubmit = (e) => {
const handleSubmit = async (e) => {
if (!form.reportValidity()) {
return
}
e.preventDefault()
createEvent(value, { logger })
value = ''
try {
const module = await import('../actions')
module.createEvent(value, { logger })
value = ''
} catch (importError) {
console.error(importError)
}
}
const handleChange = (e) => {