UNPKG

@xsprtd/nuxt-api

Version:

Nuxt API Authentication and Http Client

10 lines (9 loc) 398 B
import parseRequestOptions from "../services/parseRequestOptions.js"; export const useApiFetch = (request, options) => { const { onRequest, onResponseError, ...otherOptions } = options || {}; const fetchService = $fetch.create(parseRequestOptions({ ...onRequest ? { onRequest } : {}, ...onResponseError ? { onResponseError } : {} })); return fetchService(request, otherOptions); };