Flo
API Routing broken
I've seen reports before and I couldn't believe it... and now I'm here.
Nitro-Routes:
2 concurrent routes: one for
:id/os/:resourceType
(generic handler) and one for :id/os/networks
(edge case handling). Latter only has a post-handler!
Code executed (server side):
This is a get-Request.
The edge case handler does not get called, that's correct.
The generic get handler gets called - and suddenly the resourceType
no longer exists in the event.
It should look like (after removing the edge case handler):
It really looks like (with edge handler):
The matchedRoute points to the correct path. But if it would be really using it, it must fail because there's no get-handler for that path.9 replies
UI: Disable button on form validation errors
I'm using nuxt ui to show a form to a user. The form is validated using a zod schema (works).
The docs say I can access the api using the form ref: I understand this as
myForm.errors
.
Trying to bind this to the disabled
-prop of my submit button doesn't do anything...3 replies
Nuxt Layer: Composable from layer not found
Following directory structure:
For unknown reason, I can't use
useK8s
in someHandler.get.ts
. Nuxt complains: ERROR [nuxt] [request error] [unhandled] [500] useK8s is not defined
.
Yet my app/.nuxt/imports.d.ts
contains export { useK8s } from '../../k8s/composables/k8s';
8 replies
Composable for accessing event scoped data?
Given following server middleware:
and an api handler calling a composable
useSomeCustomComposable()
, is there a way to access the currentUser
-object in that composable without passing it through function arguments?
Above implementation was an experiment. Happy to change that.
Background: That custom composable is used in many routes. For the sake of code dedup, I'd prefer to not extend all calls with something that never changes. I'm propably just blind and it's an easy thing to do, but neither my brain, nor chatgpt were really helpful with that so far.5 replies
Can't define server plugin in custom module
I tried following the docs: https://nuxt.com/docs/api/kit/nitro#examples-3
Result:
Cannot find name 'defineNitroPlugin'
3 replies