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

_How to run "useLazyAsyncData" on client-side only?_ Use the "clientSide" option. For example: Nuxt.useLazyAsyncData(objects, { clientSide: true }); #27278

Closed
2 of 4 tasks
toknT opened this issue May 20, 2024 · 2 comments

Comments

@toknT
Copy link

toknT commented May 20, 2024

Summary (generated):

A user needs to log in with a token stored in local storage before accessing certain data, but when using the useLazyAsyncData function, it results in an unauthorized error on the server-side. The user is willing to help implement this feature and suggests it could be implemented as a module. Prior to implementation, the user has reviewed the contribution guide and checked existing discussions and issues.


Describe the feature

There are some data need user login with the token I store in localstorage. But if I run useLazyAsyncData it will get unauthoried error on server side.

So current I create component use useLazyAsyncData in it and put it in <client-only></client-only>

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

@nuxtbot nuxtbot changed the title How to run useLazyAsyncData on client-side only. _How to run "useLazyAsyncData" on client-side only?_ Use the "clientSide" option. For example: Nuxt.useLazyAsyncData(objects, { clientSide: true }); May 20, 2024
@warflash
Copy link
Member

warflash commented May 20, 2024

@yxw007
Copy link

yxw007 commented May 21, 2024

I've also encountered this problem, is it possible that the interface that requires a token can only be called on the client side?

@warflash warflash closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants