1
1
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:
zeot 2018-09-08 16:09:57 +03:00
parent 65848205c9
commit bd33eedf23
2 changed files with 7 additions and 1 deletions

View File

@ -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'))

View File

@ -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,