--- import { Icon } from "astro-icon/components"; import { Get } from "../pocketbase/Get"; import { Authentication } from "../pocketbase/Authentication"; import EventEditor from "./Officer_EventManagement/EventEditor"; import FilePreview from "../modals/FilePreview"; // Get instances const get = Get.getInstance(); const auth = Authentication.getInstance(); interface Event { id: string; event_name: string; event_description: string; event_code: string; location: string; files: string[]; points_to_reward: number; start_date: string; end_date: string; published: boolean; has_food: boolean; attendees: AttendeeEntry[]; } interface AttendeeEntry { user_id: string; time_checked_in: string; food: string; } interface ListResponse { page: number; perPage: number; totalItems: number; totalPages: number; items: T[]; } // Initialize variables let eventResponse: ListResponse = { page: 1, perPage: 5, totalItems: 0, totalPages: 0, items: [], }; let upcomingEvents: Event[] = []; // Fetch events try { if (auth.isAuthenticated()) { eventResponse = await get.getList( "events", 1, 5, "", "-start_date" ); upcomingEvents = eventResponse.items; } } catch (error) { console.error("Failed to fetch events:", error); } const totalEvents = eventResponse.totalItems; const totalPages = eventResponse.totalPages; const currentPage = eventResponse.page; --- { // Reset cache timestamp to force refresh window.lastCacheUpdate = 0; // Refresh events list window.fetchEvents(); }} />