NuxtN
Nuxt2y ago
10 replies
Furnaxe

UPagination

I've set up a watch when the "page" state changes, which refreshes the data, but it has no effect even though the page state does change, why?

const { data: yachtsData, error, refresh } = useFetch(
    '/api/yachts/getAllYachts', {
      method: 'GET',
      headers: {
        'Content-Type': 'application/json',
      },
      params: {
        page: page.value,
      },
    });
watch(page, () => {
  refresh();
});

<UPagination v-model="page" :page-count="5" :total="yachtsData.total" />
Was this page helpful?