Commit 8255a01b authored by Evan You's avatar Evan You

fetchData -> asyncData

parent 0253ebcc
......@@ -5,9 +5,9 @@ import { createApp } from './app'
// a global mixin to invoke fetchData on the client
Vue.mixin({
beforeMount () {
const { fetchData } = this.$options
if (fetchData) {
this.dataPromise = fetchData(
const { asyncData } = this.$options
if (asyncData) {
this.dataPromise = asyncData(
this.$store,
this.$route
)
......
......@@ -27,7 +27,7 @@ export default context => {
// which is resolved when the action is complete and store state has been
// updated.
Promise.all(matchedComponents.map(component => {
return component.fetchData && component.fetchData(
return component.asyncData && component.asyncData(
store,
router.currentRoute,
context
......
......@@ -10,7 +10,7 @@ export default function createListView (type) {
return {
name: `${type}-stories-view`,
fetchData (store, route, context) {
asyncData (store, route, context) {
return store.dispatch('FETCH_LIST_DATA', { type }).then(() => {
setTitle(camelize(type), context)
})
......
......@@ -46,7 +46,7 @@ export default {
}
},
fetchData (store, { params: { id }}, context) {
asyncData (store, { params: { id }}, context) {
return store.dispatch('FETCH_ITEMS', { ids: [id] }).then(() => {
const item = store.state.items[id]
setTitle(item.title, context)
......
......@@ -30,7 +30,7 @@ export default {
}
},
fetchData (store, { params: { id }}, context) {
asyncData (store, { params: { id }}, context) {
return store.dispatch('FETCH_USER', { id }).then(() => {
const user = store.state.users[id]
setTitle(user.id, context)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment