TorErik
TorErik
NNuxt
Created by TorErik on 5/29/2024 in #❓・help
File is not a module - Typescript
I'm setting up typescript in a Nuxt project for the first time. I have generated types from my supabase DB according to the docs https://supabase.com/docs/guides/api/rest/generating-types But when I do import { Database } from '~/types/supabase'; I get this error: "File '/types/supabase.ts' is not a module." import type { Database } from '~/types/supabase'; does nothing. Why is this happening?
1 replies
NNuxt
Created by TorErik on 2/20/2024 in #❓・help
Absolute path must have the exact same param named "param" as its parent
No description
4 replies
NNuxt
Created by TorErik on 3/22/2023 in #❓・help
Get error code from $fetch
How can I get the error code from $fetch when a request fails? I need to do call different methods based on the type of error. I have server route that returns a promise like this, but it only logs the error message and doesn't give any other information:
$fetch.raw(url, {
method: 'GET',
headers: { 'Authorization': 'Bearer ' + token, },
params: requestParams,
}).catch((error) => {
console.log(error)
})
$fetch.raw(url, {
method: 'GET',
headers: { 'Authorization': 'Bearer ' + token, },
params: requestParams,
}).catch((error) => {
console.log(error)
})
7 replies
NNuxt
Created by TorErik on 2/17/2023 in #❓・help
localePath issue
In nuxt 2 I have this code to generate links to a given route name:
nuxtApp.$localePath({
name: routeName,
params: {
site: siteStore.siteName,
module: currentModule,
group: params.group,
}
})
nuxtApp.$localePath({
name: routeName,
params: {
site: siteStore.siteName,
module: currentModule,
group: params.group,
}
})
According to this: https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md#414-2022-08-22 params is now ignored in vue-router: I have read the docs, but the language is confusing to me. I don't understand how to rewrite it to make it work as intended. Can someone ELI5 what the recommended approach is?
7 replies