JuanMCe
JuanMCe
NNuxt
Created by JuanMCe on 10/7/2024 in #❓・help
Redirect inside asyncData
I want to redirect to a named route inside asyncData, my nuxt project is ssr: false I have something like this in my Page component:
async asyncData({ store, params, query, $axios, redirect }) {
// ...some logic
if (purchaseTransaction.status === 'confirmed') {
redirect({
name: 'exchange-status',
params: { id: purchaseTransaction.exchange.id },
});
}
// ...more logic
async asyncData({ store, params, query, $axios, redirect }) {
// ...some logic
if (purchaseTransaction.status === 'confirmed') {
redirect({
name: 'exchange-status',
params: { id: purchaseTransaction.exchange.id },
});
}
// ...more logic
I have a router.js file I use to extend some routes with extendRoutes in my nuxt config. My route is defined like this:
{
path: '/estado-canje/:id',
name: 'exchange-status',
component: resolve(__dirname, 'pages_ignore/exchange/status.vue'),
},
{
path: '/estado-canje/:id',
name: 'exchange-status',
component: resolve(__dirname, 'pages_ignore/exchange/status.vue'),
},
I get redirected to my home instead and I get this error in the browser console: [vue-router] Route with name 'exchange-status' does not exist I can enter the route directly without problems but I have no idea why redirect doesn't work
2 replies
NNuxt
Created by JuanMCe on 9/18/2024 in #❓・help
Same component for two routes breaks layout
No description
2 replies