API Composables
useError
useError composable returns the global Nuxt error that is being handled.
The composable returns the global Nuxt error that is being handled and it is available on both client and server.
const error = useError()
useError
sets an error in the state and creates a reactive as well as SSR-friendly global Nuxt error across components.
Nuxt errors have the following properties:
interface { // HTTP response status code statusCode: number // HTTP response status message statusMessage: string // Error message message: string}
useCookie
useCookie is an SSR-friendly composable to read and write cookies.
useFetch
This composable provides a convenient wrapper around useAsyncData and $fetch. It automatically generates a key based on URL and fetch options, provides type hints for request url based on server routes, and infers API response type.