Is it possible to have $santumFetch utils function instead of useSanctumClient
composable?
#303
Replies: 2 comments
-
Hey @misbahansori! Thanks for the feedback. Right now there is no way to use it like that because initial idea was to provide flexible way of requesting data. For instance you don't necessarily need this Currently, Nuxt doesn't recommend using helpers like Note that we highly recommend using composables instead of providing helpers to avoid polluting the global namespace and keep your main bundle entry small. However, I do not see any problem with introducing module-specific composable like |
Beta Was this translation helpful? Give feedback.
-
The feature can be tracked here - #305 |
Beta Was this translation helpful? Give feedback.
-
When we want to fetch data from the server, currently we have to use
useSanctumClient
composable.It's a bit inconvenient to have to create a client every time we want to fetch data from the server.
I'm wondering if it's possible to have a
$santumFetch
utils (or a better name) that we could use without having to create a client. I think it would be more convenient and also align with the$fetch
utils nuxt provides.Also, it would be great if we could have a
useSanctumFetch
composable that can simplify the code when we want to fetch data from the server.I'm not sure if this is possible, but I think it would be a great addition to the Sanctum plugin.
Previously I was using this https://github.com/amrnn90/breeze-nuxt plugin, and it had a
$larafetch
utils anduseLarafetch
composable that were doing exactly this.Beta Was this translation helpful? Give feedback.
All reactions