[Alexander Lichter] Custom $fetch and Repository Pattern in Nuxt 3

🎯 Π—Π°Π³Ρ€ΡƒΠΆΠ΅Π½ΠΎ автоматичСски Ρ‡Π΅Ρ€Π΅Π· Π±ΠΎΡ‚Π°: 🚫 ΠžΡ€ΠΈΠ³ΠΈΠ½Π°Π» Π²ΠΈΠ΄Π΅ΠΎ: πŸ“Ί Π”Π°Π½Π½ΠΎΠ΅ Π²ΠΈΠ΄Π΅ΠΎ ΠΏΡ€ΠΈΠ½Π°Π΄Π»Π΅ΠΆΠΈΡ‚ ΠΊΠ°Π½Π°Π»Ρƒ Β«Alexander LichterΒ» (@TheAlexLichter). Оно прСдставлСно Π² нашСм сообщСствС ΠΈΡΠΊΠ»ΡŽΡ‡ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎ Π² ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΠΎΠ½Π½Ρ‹Ρ…, Π½Π°ΡƒΡ‡Π½Ρ‹Ρ…, ΠΎΠ±Ρ€Π°Π·ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒΠ½Ρ‹Ρ… ΠΈΠ»ΠΈ ΠΊΡƒΠ»ΡŒΡ‚ΡƒΡ€Π½Ρ‹Ρ… цСлях. НашС сообщСство Π½Π΅ ΡƒΡ‚Π²Π΅Ρ€ΠΆΠ΄Π°Π΅Ρ‚ Π½ΠΈΠΊΠ°ΠΊΠΈΡ… ΠΏΡ€Π°Π² Π½Π° Π΄Π°Π½Π½ΠΎΠ΅ Π²ΠΈΠ΄Π΅ΠΎ. ΠŸΠΎΠΆΠ°Π»ΡƒΠΉΡΡ‚Π°, ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΡ‚Π΅ Π°Π²Ρ‚ΠΎΡ€Π°, посСтив Π΅Π³ΠΎ ΠΎΡ€ΠΈΠ³ΠΈΠ½Π°Π»ΡŒΠ½Ρ‹ΠΉ ΠΊΠ°Π½Π°Π». βœ‰οΈ Если Ρƒ вас Π΅ΡΡ‚ΡŒ ΠΏΡ€Π΅Ρ‚Π΅Π½Π·ΠΈΠΈ ΠΊ авторским ΠΏΡ€Π°Π²Π°ΠΌ Π½Π° Π΄Π°Π½Π½ΠΎΠ΅ Π²ΠΈΠ΄Π΅ΠΎ, поТалуйста, ΡΠ²ΡΠΆΠΈΡ‚Π΅ΡΡŒ с Π½Π°ΠΌΠΈ ΠΏΠΎ ΠΏΠΎΡ‡Ρ‚Π΅ support@, ΠΈ ΠΌΡ‹ Π½Π΅ΠΌΠ΅Π΄Π»Π΅Π½Π½ΠΎ ΡƒΠ΄Π°Π»ΠΈΠΌ Π΅Π³ΠΎ. πŸ“ƒ ΠžΡ€ΠΈΠ³ΠΈΠ½Π°Π»ΡŒΠ½ΠΎΠ΅ описаниС: πŸ’» 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 own $fetch instance ‼️ Making sure that it works with composables and standalone πŸ‘©β€πŸ’» Building the demo app step by step --- Links: πŸ“ΊοΈ Do you use useFetch wrong?! - πŸ”— Sebastien Chopin’s blog post about custom $fetch - πŸ“ΊοΈ Class Serialization Errors - πŸ”— Code - πŸ”— My repository pattern blog post Don’t forget to hit that β€œSubscribeβ€œ button, ring the notification bell and give a thumbs up! 🌐 Connect further: Website: Twitter/X: Twitch: Chapters: Intro A warning when misusing useAsyncData or useFetch Demo app Implementing the repository pattern Passing a $fetch instance Creating our own $fetch instance Globally providing $fetch using runtimeConfig Summary Keywords: repository pattern nuxt nuxt3 custom $fetch fetch
Back to Top