Nuxt2mo ago

Create global instance of ofetch

I want to create a global ofetch instance, on which I can add custom header and I want it to be present on all $fetch and useFetch calls from. What is the best way to do this, if it is even possible?
2 Replies
manniL2mo ago
Alexander Lichter
Custom $fetch and Repository Pattern in Nuxt 3
💻 The repository pattern is a popular way to abstract your API calls away and provide a descriptive way to retrieve or send data. But how would you implement it in Nuxt? And should you use composables or $fetch for it? This video will give answers to all the questions! Key points: 🎛️ Implementing the repository pattern in Nuxt 🔛 Creating our ow...