Questions tagged [usefetch]

8 questions
2
votes
1 answer

Nuxt 3 cache and pagination with useNuxtData

Since latest Nuxt 3 version, cache has to be manually handled using useNuxtData() composable. This code is an extract of what I do to cache a single detail post, calling an API endpoint. const post = ref({}) // Get cached post using slug as cache…
Luciano
  • 2,052
  • 1
  • 16
  • 26
0
votes
0 answers

Data Fetching: Error: [nuxt] A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware

I am trying to fetch certain global page data and then save it. This should allow other components to use that data instead of loading the data in each place I need it. (See my other thread: How to reuse fetched data in vue 3 (nuxt 3)?) I have this…
Merc
  • 4,241
  • 8
  • 52
  • 81
0
votes
1 answer

POST request from Nuxt to Laravel Sanctum ends up at login page

I spend hours trying to debug googling arround but with no good result. I am using Laravel 8 with Sanctum package and latest Nuxt as frond-end. I setup couple endpoints and made them work - GET requests only. When I got to the forms section, where I…
0
votes
1 answer

How to reuse fetched data in Vue 3 (Nuxt 3)?

I am updating a Nuxt2 project to Nuxt3. Before I used Vuex to share some data across my app. I loaded the navigation structure from an endpoint and could use that information across my components. Now in Nuxt 3 I thought I could write a composable…
Merc
  • 4,241
  • 8
  • 52
  • 81
0
votes
1 answer

Nuxt3 useFetch not refreshing on slug change

I am trying to use nuxt3s useFetch feature to fetch the pages content. Whenever the slug changes I want to refetch/refresh. The docs (https://nuxt.com/docs/getting-started/data-fetching) tell me that: the URL is auto-watched, so a refresh should…
Merc
  • 4,241
  • 8
  • 52
  • 81
0
votes
0 answers

Nuxt 3 - useFetch when one query depends on the result of another

I'm working on a headless Nuxt 3 app and I'm running into an issue with my blog. I think this exposing a gap in my knowledge of how Nuxt 3's fetch utils work. Here's the overview of what I need to happen: The hero of the blog page is a post feature…
0
votes
0 answers

Problem with useLazyFetch with nuxt bridge

I am trying to use useLazyFetch in a project where I recently upgraded from nuxt 2 to nuxt-bridge. Like described here: https://nuxt.com/docs/bridge/bridge-composition-api#useasync-and-usefetch I thought I could use this code: