avalanche
avalanche
NNuxt
Created by avalanche on 3/2/2025 in #❓・help
Do I need to make an index.get.ts file or is there a way to get [...path].get.ts to catch the root?
I have a server route path such that notebook/[...path].get.ts works to catch any notebook/woo routes but not the notebook/ route. Is there a way to get the catch all route to apply to the root/index route without creating a index.ts file?
4 replies
NNuxt
Created by avalanche on 10/10/2024 in #❓・help
Same useLazyAsyncData and useFetch - but useLazyAsyncData not fetch on initial render or hard refres
const {
status,
data: airlines,
error,
refresh
} = useFetch('/api/airlines/list', {
lazy: true,
params: queryItems,
transform: (airlines: ListResult<Airline>) => transformer(airlines)
})

const {
status,
data: airlines,
error,
refresh
} = await useLazyAsyncData(
'airlines',
() =>
$fetch('/api/airlines/list', {
params: queryItems
}),
{
transform: (airlines: ListResult<Airline>) => transformer(airlines)
}
)
const {
status,
data: airlines,
error,
refresh
} = useFetch('/api/airlines/list', {
lazy: true,
params: queryItems,
transform: (airlines: ListResult<Airline>) => transformer(airlines)
})

const {
status,
data: airlines,
error,
refresh
} = await useLazyAsyncData(
'airlines',
() =>
$fetch('/api/airlines/list', {
params: queryItems
}),
{
transform: (airlines: ListResult<Airline>) => transformer(airlines)
}
)
I have those two functions and I think they are the same? But for some reason the useLazyAsyncData doesn't seem to make the api call on initial load - it will if I navigate away and navigate back. Any thoughts on what I am doing wrong?
3 replies