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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When we want to fetch data from the server, currently we have to use
useSanctumClientcomposable.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
$santumFetchutils (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$fetchutils nuxt provides.Also, it would be great if we could have a
useSanctumFetchcomposable 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
$larafetchutils anduseLarafetchcomposable that were doing exactly this.Beta Was this translation helpful? Give feedback.
All reactions