LogoLogo
Home
  • Documentation
  • Developers
  • The Venue Developer Documentation
  • Next.js SDK
    • React Components
      • VenueContent
      • VenueImage
    • reference
      • Index
      • functions
        • VenueContent
        • VenueImage
        • getEvent
        • getEvents
        • getLocalizedContent
        • getPage
        • getPages
        • getProduct
        • getProducts
        • getProfile
        • getProfileEvents
        • getProfiles
        • getSite
        • setConfig
      • interfaces
        • NodeHandlers
        • NodeProps
        • RenderNode
      • type-aliases
        • ContentStyles
        • Event
        • GetEventData
        • GetEventError
        • GetEventResponse
        • GetEventsData
        • GetEventsError
        • GetEventsResponse
        • GetPageData
        • GetPageError
        • GetPageResponse
        • GetPagesData
        • GetPagesError
        • GetPagesResponse
        • GetProductData
        • GetProductError
        • GetProductResponse
        • GetProductsData
        • GetProductsError
        • GetProductsResponse
        • GetProfileData
        • GetProfileError
        • GetProfileEventsData
        • GetProfileEventsError
        • GetProfileEventsResponse
        • GetProfileResponse
        • GetProfilesData
        • GetProfilesError
        • GetProfilesResponse
        • GetSiteData
        • GetSiteError
        • GetSiteResponse
        • LocalizedContent
        • Location
        • MediaItem
        • NodeHandler
        • Page
        • Product
        • ProductVariant
        • Profile
        • Site
        • SiteSettings
        • TicketOnEvent
        • publishState
        • recordType
  • TypeScript SDK
    • reference
      • Index
      • functions
        • getEvent
        • getEvents
        • getLocalizedContent
        • getPage
        • getPages
        • getProduct
        • getProducts
        • getProfile
        • getProfileEvents
        • getProfiles
        • getSite
        • setConfig
      • type-aliases
        • Event
        • GetEventData
        • GetEventError
        • GetEventResponse
        • GetEventsData
        • GetEventsError
        • GetEventsResponse
        • GetPageData
        • GetPageError
        • GetPageResponse
        • GetPagesData
        • GetPagesError
        • GetPagesResponse
        • GetProductData
        • GetProductError
        • GetProductResponse
        • GetProductsData
        • GetProductsError
        • GetProductsResponse
        • GetProfileData
        • GetProfileError
        • GetProfileEventsData
        • GetProfileEventsError
        • GetProfileEventsResponse
        • GetProfileResponse
        • GetProfilesData
        • GetProfilesError
        • GetProfilesResponse
        • GetSiteData
        • GetSiteError
        • GetSiteResponse
        • LocalizedContent
        • Location
        • MediaItem
        • Page
        • Product
        • ProductVariant
        • Profile
        • Site
        • SiteSettings
        • TicketOnEvent
        • publishState
        • recordType
  • REST API
    • Api
      • V2
        • Public
          • Events
          • Pages
          • Products
          • Site
          • Profiles
            • Events
Powered by GitBook
On this page
  • Function: getEvent()
  • Parameters
  • Returns
  • Example
Export as PDF
  1. Next.js SDK
  2. reference
  3. functions

getEvent

Last updated 1 day ago


Function: getEvent()

function getEvent(params): Promise<
  | {
  data: undefined;
  error: unknown;
 }
  | {
  data: Event;
  error: undefined;
} & object>

Defined in:

Retrieve data for a single event

Parameters

Parameter
Type

params

Omit<{ siteKey: string; slug: string; }, "siteKey">

Returns

Example

import { getEvent } from "@venuecms/sdk";
import { ContentRender, type RenderNode } from "@/lib/utils/renderer";

const { data: event } = await getEvent({ slug });

// If the event is not found, you should do something like a 404
if (!event) {
  notFound();
}
const { localizedContent, location, artists } = event;

// Get the content in a localized form (usually locale is pulled from somewhere like your url params)
const { content } = getLocalizedContent(event.localizedContent, locale);

// Render content for the event
return (
  <div>
    <VenueContent classes={renderedStyles} content={content} />
  </div>
);

Promise< | {data: undefined;error: unknown; } | {data: ;error: undefined; } & object>

@venuecms/sdk-next
sdk/dist/index.d.mts:571
Event