@illinois-grad/vue-useful-api

Vue 3 API integration utilities with reactive state management for Graduate College applications
5,456
Install
npm install @illinois-grad/vue-useful-api
Latest Version:2.1.18
Vue:3
License:MIT
Last Updated:Oct 16, 2026
Links: GitHub  ·  npm
Maintainer: marvel-uiuc

@illinois-grad/vue-useful-api

Vue 3 API integration utilities with reactive state management for Graduate College applications.

Features

  • Reactive State - Automatic loading, error, and response state management
  • Event Hooks - onSuccess, onError, and onFinally callbacks
  • Request Deduplication - Ignores stale responses automatically
  • Auto-execution - apiWatch composable for reactive API calls
  • Error Handling - User-friendly error messages with type guards
  • Type Safe - Written in TypeScript with full type definitions

Installation

npm install @illinois-grad/vue-useful-api

Peer Dependencies

This package requires the following peer dependencies:

{
  "vue": "^3.0.0"
}

Usage

Automatic Execution with apiWatch

The apiWatch composable automatically executes API calls when reactive dependencies change:

import { ref } from 'vue'
import { usefulApi, apiWatch } from '@illinois-grad/vue-useful-api'
import { useUsersApi } from './users'

const userId = ref('123')
const includeDetails = ref(true)

const users = useUsersApi();
const me = users.getMe();

apiWatch(me.execute, () => {
    if (auth.isAuthenticated) {
        return [userId.value, includeDetails.value];
    }
    // Return undefined to skip execution
    return undefined;
});

// The response is reactive
const profile = computed(() => {
    return me.response.value?.userInfo;
});

// You can also use event hooks
me.onSuccess((user) => {
  console.log('User loaded:', user)
})

// Now whenever userId or includeDetails changes, the API is called automatically
userId.value = '456' // Triggers API call with new ID
includeDetails.value = false // Triggers API call with new details flag

// The error state is also reactive
me.error.value // null if no error

// And errors have events
me.onError((error) => {
  console.error('Failed to load user:', error)
});

// The loading state is also reactive
me.isLoading.value // false if finished

Related Packages

@directive-run/vue

Vue composition API adapter for Directive.

13,087 5
@kontsedal/olas-vue

Olas Vue adapter — olasPlugin, useRoot, useValue, useQuery, useInfiniteQuery, us...

450 0
@composy/store-vue

Vue 3 状态管理适配器 - 基于 Pinia 的增强版状态管理解决方案

0
@diphyx/harlemify

API state management for Nuxt powered by Harlem

4,809 1
vusion-api

Vusion Node.js API

47,573 2

Version History

Version Released Vue License
2.1.18 ^3.5.27 MIT
2.1.17 ^3.5.27 MIT
2.1.16 ^3.5.27 MIT
2.1.15 ^3.5.27 MIT
2.1.14 ^3.5.27 MIT