generate_async_data_composable
Generate a useAsyncData composable to replace Nuxt 2 asyncData() or fetch() hooks, simplifying migration to Nuxt 3.
Instructions
Generate a useAsyncData composable to replace Nuxt 2 asyncData() or fetch() lifecycle hooks.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Composable name (e.g., 'usePosts') | |
| relativePath | Yes | Relative path in target (e.g., 'composables/usePosts.ts') | |
| module | No | Optional module name | |
| targetPath | No | Optional absolute target path override | |
| endpoint | No | API endpoint to fetch from | |
| key | No | Cache key for useAsyncData | |
| hasLazyLoad | No | Whether to use lazy loading |