Skip to content

useUheadless

The useUheadless composable is the main composable where you can communicate directly with your uheadless instance.

The composable has 5 resouce types that you can query. Each has it's own set of options that you provide.

Some of the options like depth and hostname can be specified in the configuration options in you nuxt.config.ts file. You can always override the default definitions by explicitly setting the option with useUheadless.

Behind the scenes, useUheadless uses useAsyncData for caching and reactivity. That means, that the return type is the same as useAsyncData with typed returns. Automatically a cache key is generated for each request based on resource type and options, so that each identical request to the same resource is cached.