0.1.5 • Published 10 months ago

vue-data-fetcher v0.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

Vue Data Fetcher

Vue Data Fetcher is a collection of composable functions that provide utility functionalities for common tasks in Vue.js projects. This package is designed to simplify and streamline the development process by encapsulating complex logic into reusable composable functions.

Installation

You can install the Vue Data Fetcher package via npm:

npm install vue-data-fetcher

Usage

To use the Vue Data Fetcher package in your Vue.js project, you can import the individual composable functions as needed.

Here's an example of how to import and use the useDataFetcherList composable:

<script setup lang="ts">
import apiClient from '@/api/ApiMock'
import type { RolesListResponse, RolesListRequest } from '@/api/ApiTypes'
import { useDataFetcherList } from 'vue-data-fetcher'
const { responseData, loading, error } = useDataFetcherList<RolesListRequest, RolesListResponse>(
  apiClient.rolesList,
  {} as RolesListRequest
)
</script>
<template>
  <h2 class="loading" v-if="loading">loading</h2>
  <h2 v-else-if="error">
    {{ error }}
  </h2>
  <h2 class="response" v-else>{{ JSON.stringify(responseData) }}</h2>
</template>

Here's an example of how to import and use the useDataFetcherFind composable:

<script setup lang="ts">
import apiClient from '@/api/ApiMock'
import type { RoleFindRequest, RoleFindResponse } from '../api/ApiTypes'
import { useDataFetcherFind } from 'vue-data-fetcher'

const { responseData, loading, error } = useDataFetcherFind<RoleFindRequest, RoleFindResponse>(
  apiClient.roleFind,
  'roleId'
)
</script>
<template>
  <h2 class="loading" v-if="loading">loading</h2>
  <h2 v-else-if="error">
    {{ error }}
  </h2>
  <h2 class="response" v-else>{{ JSON.stringify(responseData) }}</h2>
</template>
0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago