proposal: support for endpoint prefix #486
Replies: 1 comment
-
|
Hey @derrickobedgiu1!
As mentioned in the docs and here, it should be done via
Unfortunately, this is not an edge case but rather a common case since we never work with one prefix for the whole app - it would not make sense then. This module provides an authentication tool, not a router functionality, so I consider it as an application-specific logic.
This will deviate from module behaviour and make it implicit for users regarding what route will be used. I would rather go with a one-time configuration on the backend side to make sure these endpoints match the
Based on the previous issues, this assumption is not true.
This functionality was not introduced on purpose since it limits users and implicilty deviate the expected behaviour while the use case is very app-specific. To sum up:
In both cases you can reduce the boilerplate and be sure that endpoints are called as they are configured. P.S. If nothing of this fits, you can always define a function helper, I remember someone was using smth like this: export const useVersionEndpoint = (url: string, version: number) => `/api/v${version}/${url}` |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey @manchenkoff
Just a small idea here that could be added. First party support for api endpoint prefix rather than having a custom composable to prefix api endpoint.
Background
It's a bit hectic to make requests to
/api/endpoint,/api/some-otheretc fom stores or the components.Proposal Format
Then the stores would just send
/endpoint,/some-other.There may be some edge cases where user has an endpoint maybe using v2 of the api eg
/api/v2/an-endpoint, but when the rest are with their let's say v1 prefix. I haven't thought of how that'd be catered for as well.The prefix would be applied for all endpoints EXCLUDING
sanctum > endpointsparameters. Thesanctum > endpointsparameters could then be concatenated against the base of thesanctum > baseUrl(no url parameters) since they usually are rarely prefixed, but room for the user to still manually provide with the prefix in thesanctum > endpointsparameters.Is this idea already easily achieved or it could be considered for addition to the package?
Beta Was this translation helpful? Give feedback.
All reactions