data
data
Explore posts from servers
NNuxt
Created by data on 11/4/2024 in #❓・help
import.meta.glob no longer typed properly
nuxt.d.ts includes the vite/client
...
/// <reference types="vite/client" />
...
...
/// <reference types="vite/client" />
...
6 replies
NNuxt
Created by Hendrik Jan on 8/15/2024 in #❓・help
Auto-import of /utils not working in VS-Code in template block
add this to declarations.d.ts in your project root
// https://github.com/nuxt/nuxt/releases/tag/v3.13.0
// TODO periodically check if this file is still needed, as libraries may update their types
import type {
ComponentCustomOptions as _ComponentCustomOptions,
ComponentCustomProperties as _ComponentCustomProperties,
} from 'vue'

declare module '@vue/runtime-core' {
interface ComponentCustomProperties extends _ComponentCustomProperties {}
interface ComponentCustomOptions extends _ComponentCustomOptions {}
}
// https://github.com/nuxt/nuxt/releases/tag/v3.13.0
// TODO periodically check if this file is still needed, as libraries may update their types
import type {
ComponentCustomOptions as _ComponentCustomOptions,
ComponentCustomProperties as _ComponentCustomProperties,
} from 'vue'

declare module '@vue/runtime-core' {
interface ComponentCustomProperties extends _ComponentCustomProperties {}
interface ComponentCustomOptions extends _ComponentCustomOptions {}
}
14 replies
NNuxt
Created by Thr0nSK on 8/6/2024 in #❓・help
Auto imported functions show type error in <template>
do you think we're going to get this in a 3.x release or will it be postponed to 4?
36 replies
NNuxt
Created by Thr0nSK on 8/6/2024 in #❓・help
Auto imported functions show type error in <template>
also happening to me on 3.10.4 when removing lockfile + reinstall :Prayge:
36 replies
NNuxt
Created by data on 4/15/2024 in #❓・help
[OPEN] Working example of access/refresh token auth?
:Sadge::Jepinged:
3 replies
NNuxt
Created by data on 4/15/2024 in #❓・help
[OPEN] Working example of access/refresh token auth?
My $fetch wrapper:
export async function useFetchCookie<T = unknown, R extends NitroFetchRequest = NitroFetchRequest, O extends NitroFetchOptions<R> = NitroFetchOptions<R>>(event: H3Event, request: R, opts?: O) {

const res = await $fetch.raw<T>(request, {
...opts,
headers: { ...opts?.headers, ...useRequestHeaders(['cookie']) },
})

// forward cookies into SSR response
const cookies = (res.headers.get('set-cookie') || '').split(',')
for (const cookie of cookies)
appendResponseHeader(event, 'set-cookie', cookie)

// Return the data of the response
return res._data
}
export async function useFetchCookie<T = unknown, R extends NitroFetchRequest = NitroFetchRequest, O extends NitroFetchOptions<R> = NitroFetchOptions<R>>(event: H3Event, request: R, opts?: O) {

const res = await $fetch.raw<T>(request, {
...opts,
headers: { ...opts?.headers, ...useRequestHeaders(['cookie']) },
})

// forward cookies into SSR response
const cookies = (res.headers.get('set-cookie') || '').split(',')
for (const cookie of cookies)
appendResponseHeader(event, 'set-cookie', cookie)

// Return the data of the response
return res._data
}
3 replies