Composables
useRestaurant
Fetches and exposes all data for a single restaurant by slug — profile, schema, reviews, FAQs, menu, and photos.
useRestaurant
Individual restaurant data composable. Accepts a slug and returns scoped fetch methods for every data type associated with that restaurant. Used internally by the restaurants/[slug].vue layout, which calls these methods via useAsyncData and provides the results to child pages through provide/inject to avoid duplicate API calls.
Usage
const {
getRestaurant,
getRestaurantSchema,
getRestaurantReviews,
getRestaurantFAQs,
getRestaurantMenu,
getRestaurantPhotos,
} = useRestaurant(slug)
Parameters
| Parameter | Type | Description |
|---|---|---|
slug | string | Ref<string> | The restaurant slug, typically from useRoute().params.slug. |
Returns
| Key | Type | Description |
|---|---|---|
getRestaurant | () => Promise<Restaurant> | Fetches the full restaurant profile object. |
getRestaurantSchema | () => Promise<WithContext<Restaurant>> | Fetches structured data (JSON-LD schema.org) for the restaurant. |
getRestaurantReviews | () => Promise<Review[]> | Fetches the review list for the restaurant. |
getRestaurantFAQs | () => Promise<FAQ[]> | Fetches FAQ entries for the restaurant. |
getRestaurantMenu | () => Promise<MenuSection[]> | Fetches the full menu (sections and items) for the restaurant. |
getRestaurantPhotos | () => Promise<Photo[]> | Fetches the photo gallery for the restaurant. |
AI Context
composable: useRestaurant
package: "@xenterprises/nuxt-x-restaurants"
use-when: >
Fetching data for a single restaurant profile page or any of its child
pages (menu, reviews, photos, articles). In the built-in layer the
restaurants/[slug].vue layout calls this once and injects results into
child pages — prefer that pattern over calling useRestaurant in multiple
child components to avoid duplicate API requests.
