kingtimm
Explore posts from serversDTDrizzle Team
•Created by iska on 8/19/2024 in #help
syntax atomic transaction d1 not working
Did you have any breakthroughs on a workaround for this?
3 replies
nuxt 3 testing examples
This directory helped me https://github.com/nuxt/test-utils/tree/main/examples
5 replies
How to check on a client side that a user was redirected from middleware?
I’m not the most experienced user and there could be other options. If we need your “/“ route to conditionally show a popup if a user was sent there by middleware, navigateTo can indicate that through query/params. Another option could be to write to a useState(“redirectReason”). You can set a ssr-friendly value in useState, and then in setup function of “/“ route you can check state to trigger your popup notification.
7 replies
How to check on a client side that a user was redirected from middleware?
Could you have the middleware insert a query param? Redirect to “/?error=true” (or some other made up name). Then you can use useRoute but look for the query param instead of the redirectFrom
7 replies
How to access the event in a server/utils function?
I haven’t tried this but saw it mentioned on another thread. https://nitro.unjs.io/guide/utils#async-context-experimental
3 replies
Is it Possible to Lazy load in Nuxt?
Have you tried the lazy prefix in your template? https://nuxt.com/docs/guide/directory-structure/components#dynamic-imports
3 replies
How to check on a client side that a user was redirected from middleware?
Welcome to Nuxt! The useRoute composable has a “redirectedFrom” param. https://nuxt.com/docs/api/composables/use-route
This gives you some options, as you could use this composable on your app.vue, your layout, or your index.vue page. Your popup could be triggered by a v-if=“useRoute().redirectedFrom” (I’m on mobile and can’t test but hope this helps point you in the right direction)
7 replies
full E2E example
This folder helped me. The full app. https://github.com/nuxt/test-utils/tree/main/examples
2 replies