1.3.5 • Published 10 months ago

@innodata/nuxtjs-alt-http v1.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Information

This serves as an extension to ohmyfetch for nuxt. Please note this is only for nuxt3. This works similar to nuxt/http and nuxtjs-alt/axios except it utilizes ohmyfetch. All property options will be under http

Other Information

If you want to override the global $fetch function you can do so by setting useConflict to true in your config. This will change:

  • $http
  • useHttp
  • useLazyHttp
  • globalThis.$http

to

  • $fetch
  • useFetch
  • useLazyFetch
  • globalThis.$fetch

Remember this is a mix of ohmyfetch and nuxt/http so to use methods you would use as an example:

// Available methods: 'get', 'head', 'delete', 'post', 'put', 'patch', 'options'
// $http.$get('/api') is the same as $fetch('/api', { method: 'get' })
await $fetch.$get('/api', options)
await $http.$get('/api', options)

// Access Raw Response
// $http.get('/api') is the same as $fetch.raw('/api', { method: 'get' })
await $fetch.get('/api', options)
await $http.get('/api', options)

Interceptors

The interceptors should work exactly like how axios has it so to access them you would use:

$http.interceptors.request.use(config)
$http.interceptors.response.use(config)

@nuxtjs-axios based functions have also been added:

$http.onRequest(config)
$http.onResponse(response)
$http.onRequestError(err)
$http.onResponseError(err)
$http.onError(err)

Config Options

import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
    modules: [
        '@nuxtjs-alt/http',
    ],
    http: {
      
    }
})

Please do tell me if you encounter any bugs.

1.3.5

10 months ago

1.3.4

10 months ago

1.3.3

10 months ago

1.5.5

10 months ago

1.5.4

10 months ago

1.5.3

10 months ago

1.5.2

10 months ago

1.5.1

10 months ago

1.5.0

10 months ago