Make it harder to make a mistake of using normal axios or fetch to call Wasp custom APIs #2350
Labels
documentation
Improvements or additions to documentation
dx
hm
Requires more thought
shouldfix
We should do/fix this at some point
It is easy to miss the fact that you need to use our
api
fromwasp/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:
andauthRequired
are documented, also mention that they need to usewasp/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
fromwasp/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.
The text was updated successfully, but these errors were encountered: