--- import MainLayout from '../layouts/MainLayout.astro'; import { getChurchName, fetchEventsJson } from '../lib/bindings.js'; let churchName = 'Church'; let events = []; try { churchName = getChurchName(); // Get upcoming events from V2 API const eventsJson = fetchEventsJson(); console.log('Raw events JSON:', eventsJson); const parsedEvents = JSON.parse(eventsJson); console.log('Parsed events:', parsedEvents); events = Array.isArray(parsedEvents) ? parsedEvents : (parsedEvents.items || []); console.log('Final events array:', events.length, 'events'); // Fallback: If no events from binding, try direct API call if (events.length === 0) { console.log('No events from binding, trying direct API call...'); try { const response = await fetch('https://api.rockvilletollandsda.church/api/events'); const apiData = await response.json(); if (apiData.success && apiData.data && apiData.data.items) { events = apiData.data.items; console.log('Loaded', events.length, 'events from direct API call'); } } catch (apiError) { console.error('Direct API call failed:', apiError); } } } catch (e) { console.error('Failed to load events:', e); } ---

Church Events

Join us for worship, fellowship, and spiritual growth in our community

{events.length > 0 ? (
{events.map(event => (
{event.image && (
{event.title}
)}

{event.title}

{event.formatted_date && (
{event.formatted_date}
)} {event.formatted_time && (
{event.formatted_time}
)} {event.location && (
{event.location}
)}
{event.description && (

{event.description}

)}
Details {event.registration_url && ( )}
))}
) : (

No Events Scheduled

Check back soon for upcoming events and gatherings

Contact Us
)}

Stay Connected

Don't miss our events and gatherings. Join our church family!