Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefetch data on pages #67

Closed
timwis opened this issue Feb 24, 2018 · 1 comment
Closed

Prefetch data on pages #67

timwis opened this issue Feb 24, 2018 · 1 comment
Labels
Projects

Comments

@timwis
Copy link
Owner

timwis commented Feb 24, 2018

Nuxt provides a fetch method on page components to prefetch data server-side. The same method is called by the browser if you navigate to it after it's initialised (I believe). The trouble is that when it's executed by the server, it doesn't include the cookies with the request, and gets a 401 Unauthorized response. Not sure how to solve this.

Related:

Frankly, if we can't get this to work, I'm not sure what the advantage of using SSR/Nuxt.js is relative to the trade-offs I've experienced with it so far.

@timwis timwis added the client label Feb 24, 2018
@timwis timwis added this to To do in MVP Feb 25, 2018
@timwis
Copy link
Owner Author

timwis commented Feb 28, 2018

Someone in nuxt discord channel recommended I instantiate axios in a plugin, which has access to context, and pull in the cookie header there. I'd have to refactor the store/api to pass down the axios instance.

nuxt/nuxt#2215 (comment)

@timwis timwis closed this as completed May 5, 2019
MVP automation moved this from To do to Done May 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
MVP
  
Done
Development

No branches or pull requests

1 participant