I'm building a multi-tenant application, where each tenant has a subdomain. I use a route group for this.
The routes look like this:
Route.group(() => {
Route.get('/auth/login', 'AuthController.showLogin')
Route.post('/auth/login', 'AuthController.login')
})
.domain(`:tenant.${Env.get('BASE_TENANT_SUBDOMAIN')}`)
//.middleware(['tenant'])
I'm using the form component:
<Form method="post" action="AuthController.login" reloadDocument>
...
</Form>
When I visit http://<tenant>.dev.local/auth/login
, I get this error in the browser:
Error
[Radonis] Cannot find route for "AuthController.login"
node_modules/@microeinhundert/radonis-shared/build/cjs/src/utils.js:26:11 invariant
node_modules/@microeinhundert/radonis-hooks/build/cjs/src/hooks/useUrlBuilder.js:28:40 findRouteOrFail
node_modules/@microeinhundert/radonis-hooks/build/cjs/src/hooks/useUrlBuilder.js:88:23 Object.make
node_modules/@microeinhundert/radonis-form/build/cjs/src/hooks/useForm.js:46:43 useForm
node_modules/@microeinhundert/radonis-form/build/cjs/src/components/Form.js:19:40 Form
node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js:5662:16 renderWithHooks
I also tried action="/auth/login"
but got the same error. Looking at the types, it seems like only the route identifier is applicable here.
If I comment out the form, it works as expected.
Looking at the stack trace, then referring to findRouteOrFail
:
|
const { routes } = useManifest() |
It seems the routes are coming from the manifest, so I will include that here:
{
"entry.client": {
"type": "entry",
"path": "/radonis/entry.client.js",
"flashMessages": [],
"messages": [],
"routes": [
"action",
"formAction",
"to",
"auto"
],
"imports": []
}
}
(it's the same regardless of whether I uncomment .domain()
or not)
At the moment, I'm still figuring out how things work, but would love to start contributing once I'm a bit more familiar with the codebase.