@f3ve/vue-notify-composables
Version:
Vue Notify composables
17 lines (14 loc) • 535 B
TypeScript
import { Ref } from 'vue';
/**
* A Vue composable that abstracts out the logic for handling loading and errors when running async code.
*/
export declare function useNotifyRequest<T = any, TArgs extends Array<any> = Array<any>>(requestHandler: (...args: TArgs) => Promise<T>, options?: {
onSuccess?: (result: Awaited<T>) => void;
onError?: (error: any) => void;
}): {
result: Ref<T | undefined>;
error: Ref<any>;
loading: Ref<boolean>;
exec: (...args: TArgs) => Promise<void>;
};
export { }