Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Execute serverPrefetch from models #114

Open
JohannesLamberts opened this issue Oct 21, 2020 · 0 comments
Open

Execute serverPrefetch from models #114

JohannesLamberts opened this issue Oct 21, 2020 · 0 comments
Assignees

Comments

@JohannesLamberts
Copy link
Contributor

We currently add this functionality inside the project-code. It would be nice to have this built-in for SSR-Applications.

Vue.mixin({
    async serverPrefetch() {
      const modelPromises = Object.values(this.$modelsProvided)
        .map((model) =>
          model.$options.serverPrefetch.map((fn) => fn.call(model)),
        )
        .flat()
      return Promise.all(modelPromises)
    },
  })
@JohannesLamberts JohannesLamberts self-assigned this Oct 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant