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

Make it harder to make a mistake of using normal axios or fetch to call Wasp custom APIs #2350

Open
Martinsos opened this issue Oct 21, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation dx hm Requires more thought shouldfix We should do/fix this at some point

Comments

@Martinsos
Copy link
Member

It is easy to miss the fact that you need to use our api from wasp/client/api to performa authenticated API requests toward Wasp custom APIs that you defined. We should somehow make that more obvious.

Maybe at the place where auth: and authRequired are documented, also mention that they need to use wasp/client/api?
Or waht if we monkey-patched axios and fetch, only in dev, to warn you if you try to use them to access custom APIs? Ha that is a bit wild, probably too wild / intrusive, even if only during dev.
What if we provided even stronger sdk for this -> we could not give you just api from wasp/client/api, but give you already typed functions to call specific apis. So incentive would be stronger to use this.

Anyway we should make this more prominent in the docs, I am sure there is some space to do that, and then it would be interesting to also do something in the Wasp itself.

@Martinsos Martinsos added documentation Improvements or additions to documentation hm Requires more thought dx shouldfix We should do/fix this at some point labels Oct 21, 2024
@Martinsos
Copy link
Member Author

Example of user getting confused with this https://discord.com/channels/686873244791210014/1297094807688056895/1297988337319284827 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation dx hm Requires more thought shouldfix We should do/fix this at some point
Projects
None yet
Development

No branches or pull requests

1 participant