add support for ENV variables
This commit is contained in:
parent
3b69f744e8
commit
4fb8eb1959
2 changed files with 8 additions and 3 deletions
|
@ -36,14 +36,14 @@ const UpcomingEvent = ({ name, location, date, time, delay, description }) => (
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const EventList = ({ CALENDAR_API_KEY }) => {
|
const EventList = ({ CALENDAR_API_KEY, EVENT_CALENDAR_ID }) => {
|
||||||
const [events, setEvents] = useState([]);
|
const [events, setEvents] = useState([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const apiKey = CALENDAR_API_KEY;
|
const apiKey = CALENDAR_API_KEY;
|
||||||
const calendarId = "666sh64sku5n29qv2a2f4598jc@group.calendar.google.com";
|
const calendarId = EVENT_CALENDAR_ID;
|
||||||
const userTimeZone = "America/Los_Angeles";
|
const userTimeZone = "America/Los_Angeles";
|
||||||
|
|
||||||
const loadGapiAndListEvents = async () => {
|
const loadGapiAndListEvents = async () => {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import UpcomingEvent from "./UpcomingEvent.astro";
|
||||||
import { LiaDotCircle } from "react-icons/lia";
|
import { LiaDotCircle } from "react-icons/lia";
|
||||||
import EventList from "./EventList.jsx";
|
import EventList from "./EventList.jsx";
|
||||||
const CALENDAR_API_KEY = import.meta.env.CALENDAR_API_KEY;
|
const CALENDAR_API_KEY = import.meta.env.CALENDAR_API_KEY;
|
||||||
|
const EVENT_CALENDAR_ID = import.meta.env.EVENT_CALENDAR_ID;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="flex ml-[15%] my-[10%]">
|
<div class="flex ml-[15%] my-[10%]">
|
||||||
|
@ -19,6 +20,10 @@ const CALENDAR_API_KEY = import.meta.env.CALENDAR_API_KEY;
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<EventList client:load CALENDAR_API_KEY={CALENDAR_API_KEY} />
|
<EventList
|
||||||
|
client:load
|
||||||
|
CALENDAR_API_KEY={CALENDAR_API_KEY}
|
||||||
|
EVENT_CALENDAR_ID={EVENT_CALENDAR_ID}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue