Polak
Polak
NNuxt
Created by Polak on 11/14/2024 in #❓・help
Has anyone played around with "nuxt-auth-sanctum"? I have some issues.
@kapa.ai I get error "nuxtApp.$fetch is of type unknown
20 replies
NNuxt
Created by Polak on 11/14/2024 in #❓・help
Has anyone played around with "nuxt-auth-sanctum"? I have some issues.
@kapa.ai I have this code but it says that NuxtApp is not defined.
import type { FetchContext } from 'ofetch'
import type { ConsolaInstance } from 'consola'

export default defineAppConfig({
sanctum: {
interceptors: {
onRequest: async (
app: NuxtApp,
ctx: FetchContext,
logger: ConsolaInstance,
) => {
ctx
.options
.headers
.set('X-Custom-Headers', 'custom-value')

logger.debug(`[onRequest] custom interceptor (${ctx.request})`)
},

onResponse: async (
app: NuxtApp,
ctx: FetchContext,
logger: ConsolaInstance,
) => {
logger.debug(`[onResponse] custom interceptor (${ctx.request})`)
},
},
},
})
import type { FetchContext } from 'ofetch'
import type { ConsolaInstance } from 'consola'

export default defineAppConfig({
sanctum: {
interceptors: {
onRequest: async (
app: NuxtApp,
ctx: FetchContext,
logger: ConsolaInstance,
) => {
ctx
.options
.headers
.set('X-Custom-Headers', 'custom-value')

logger.debug(`[onRequest] custom interceptor (${ctx.request})`)
},

onResponse: async (
app: NuxtApp,
ctx: FetchContext,
logger: ConsolaInstance,
) => {
logger.debug(`[onResponse] custom interceptor (${ctx.request})`)
},
},
},
})
20 replies
NNuxt
Created by Polak on 11/14/2024 in #❓・help
Has anyone played around with "nuxt-auth-sanctum"? I have some issues.
@kapa.ai If I were to add a app.config.ts file, will this run automatically or?
20 replies
NNuxt
Created by Polak on 11/11/2024 in #❓・help
(Solved) Nuxt with SASS - Legacy Deprecation
Solved. For anyone else experiencing this issue. Install sass embedded:
pnpm add -D sass-embedded
pnpm add -D sass-embedded
And add this to your nuxt.config.ts:
vite: {
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler' // or "modern"
}
}
}
},
vite: {
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler' // or "modern"
}
}
}
},
Yoinked from smart brains out there on the internet.
6 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
Oh okay. In that case an error must be given to people who tries and visit a language that doesnt exist. Thanks for your help. Real champ!
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
No luck sadly. COULD it be that it doesnt listen to i18n.config.ts? you say it is auto imported but maybe my stuff is cursed? I might have set it up wrong maybe
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
yeah
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
Still error. Cursed as hell haha.
WARN [Vue Router warn]: No match found for location with path "/fi"


WARN [Vue Router warn]: No match found for location with path "/fi"


WARN [Vue Router warn]: No match found for location with path "/fi"
WARN [Vue Router warn]: No match found for location with path "/fi"


WARN [Vue Router warn]: No match found for location with path "/fi"


WARN [Vue Router warn]: No match found for location with path "/fi"
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
Still error on /fi
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
No description
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
export default {
fallbackLocale: ['en'],
};
export default {
fallbackLocale: ['en'],
};
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
Yeah.
export default defineNuxtConfig({
devtools: { enabled: true },
css: ['~/assets/scss/styles.scss'],

vite: {
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "~/assets/scss/_variables.scss" as *;'
}
}
}
},

modules: ["@nuxtjs/i18n", "@nuxt/image"],
i18n: {
lazy: true,
langDir: "locales",
strategy: "prefix_and_default",
defaultLocale: "en",
locales: [
{
code: "en",
iso: "en-US",
name: "English",
file: "en-US.json"
},
{
code: "da",
iso: "da-DK",
name: "Dansk",
file: "da-DK.json"
}
],
vueI18n: './i18n.config.ts'
}
})
export default defineNuxtConfig({
devtools: { enabled: true },
css: ['~/assets/scss/styles.scss'],

vite: {
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "~/assets/scss/_variables.scss" as *;'
}
}
}
},

modules: ["@nuxtjs/i18n", "@nuxt/image"],
i18n: {
lazy: true,
langDir: "locales",
strategy: "prefix_and_default",
defaultLocale: "en",
locales: [
{
code: "en",
iso: "en-US",
name: "English",
file: "en-US.json"
},
{
code: "da",
iso: "da-DK",
name: "Dansk",
file: "da-DK.json"
}
],
vueI18n: './i18n.config.ts'
}
})
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
Hey @xibman. I just tried but it still seems like it doesnt work. After visiting /fi/teams I still get 404 instead of being redirected to /teams. At least it is not longer complaining so thank you very much for that but seems to not work yet. :/
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
I still have the same error as above. Yes, I was able to set the fallbackLocale without my IDE complaining but it actually never worked.
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
No description
33 replies
NNuxt
Created by Polak on 6/7/2024 in #❓・help
i18n fallback issues
See. You always solve it after asking the community. In case anyone else runs into the same issue, remove "defineNuxtConfig" so it says "export default { ...." instead.
33 replies