mirror of
https://github.com/aelve/guide.git
synced 2024-12-23 12:52:31 +03:00
Fixed executing asyncData function on server on component resolving
This commit is contained in:
parent
65848205c9
commit
bd33eedf23
@ -1,11 +1,14 @@
|
||||
const path = require('path')
|
||||
const moment = require('moment')
|
||||
const axios = require('axios')
|
||||
|
||||
const appName = 'Aelve Guide'
|
||||
const clientPort = 4000
|
||||
const ssrPort = 5000
|
||||
const distPath = rootResolve('./dist')
|
||||
|
||||
axios.defaults.baseURL = `http://localhost:${ssrPort}`
|
||||
|
||||
const env = {
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||
'process.env.BUILD_TIME': JSON.stringify(moment(new Date()).format('YYYY-MM-DD HH:mm:ss'))
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'reflect-metadata'
|
||||
import _get from 'lodash/get'
|
||||
import { createApp } from './app'
|
||||
|
||||
export default context => {
|
||||
@ -18,7 +19,9 @@ export default context => {
|
||||
}
|
||||
|
||||
Promise.all(matchedComponents.map((Component) => {
|
||||
const asyncDataFunc = Component['asyncData'] || (Component['options'] || {})['asyncData']
|
||||
const asyncDataFunc = Component['asyncData']
|
||||
|| _get(Component, 'options.asyncData')
|
||||
|| _get(Component, 'options.methods.asyncData')
|
||||
if (typeof asyncDataFunc === 'function') {
|
||||
return asyncDataFunc({
|
||||
store,
|
||||
|
Loading…
Reference in New Issue
Block a user