Closed UlugbekNG closed 2 weeks ago
Start a new pull request in StackBlitz Codeflow.
Fixed with using server proxy
import { joinURL } from "ufo";
export default defineEventHandler(async (event): Promise<string> => {
const { devProxy, prodProxy } = useRuntimeConfig();
const proxyUrl: string = devProxy;
console.log('proxyUrl', proxyUrl);
const path: string = event.path.replace(/^\/api\//, '');
const url: string = joinURL(proxyUrl, path);
return proxyRequest(event, url);
})
Environment
Reproduction
https://stackblitz.com/edit/nuxt-starter-ka88sa?file=README.md
Describe the bug
https://medium.com/@luizzappa/nuxt-3-repository-pattern-organising-and-managing-your-calls-to-apis-with-typescript-acd563a4e046
using method from this Article and I have duplicated requests in network. You can check everything in reproduction link how i wrote this. But duplicating only when using baseUrl in fetch options. As you can see I'm using @nuxt-alt/proxy (settings you can check in Reproduction link). Wrapping call to useAsyncData not working.
If I add baseUrl in api.ts composable, there is no duplicates
Some Screenshots Image-1 image-2
Additional context
I will be very happy if someone can help me
Logs
No response