mirror of
https://github.com/aelve/guide.git
synced 2024-12-25 13:51:45 +03:00
24 lines
565 B
TypeScript
24 lines
565 B
TypeScript
import 'reflect-metadata'
|
|
import _get from 'lodash/get'
|
|
import { createApp } from './app'
|
|
|
|
export default async context => {
|
|
return new Promise((resolve, reject) => {
|
|
const { app, router, store } = createApp()
|
|
|
|
router.push(context.url)
|
|
router.onReady(() => {
|
|
const matchedComponents = router.getMatchedComponents()
|
|
|
|
if (!matchedComponents.length) {
|
|
return reject({
|
|
code: 404,
|
|
error: new Error('no component matched')
|
|
})
|
|
}
|
|
context.state = store.state
|
|
resolve(app)
|
|
}, reject)
|
|
})
|
|
}
|