Skip to content

Commit

Permalink
Minor code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
KVinyl committed Mar 26, 2024
1 parent 095c0ed commit 089b696
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/hooks/useCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const useCalendar = (events) => {
[eventsByDateString]
);

return {selectedDate, setSelectedDate, displayedEvents, tileClassName}
}
return { selectedDate, setSelectedDate, displayedEvents, tileClassName };
};

export default useCalendar;
export default useCalendar;
54 changes: 27 additions & 27 deletions src/hooks/useEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@ import { useState, useEffect } from 'react';
import ical from 'cal-parser';

const useEvents = () => {
const [events, setEvents] = useState([]);
const [events, setEvents] = useState([]);

const fetchData = async () => {
try {
const response = await fetch(
'https://docs.google.com/document/d/1OcnWWt1qHaJWE-8v_FPtNO8DKviRQ7DMaqylupuvPXE/export?format=txt'
);

const content = await response.text();
return content;
} catch (error) {
return null;
}
};

useEffect(() => {
const eventsData = async () => {
const fetchData = async () => {
try {
const fetchedData = await fetchData();
const parsedData = ical.parseString(fetchedData);
return parsedData.events;
const response = await fetch(
'https://docs.google.com/document/d/1OcnWWt1qHaJWE-8v_FPtNO8DKviRQ7DMaqylupuvPXE/export?format=txt'
);

const content = await response.text();
return content;
} catch (error) {
return [];
return null;
}
};
eventsData().then((data) => {
setEvents(data);
});
}, []);

return {events}
}
useEffect(() => {
const eventsData = async () => {
try {
const fetchedData = await fetchData();
const parsedData = ical.parseString(fetchedData);
return parsedData.events;
} catch (error) {
return [];
}
};
eventsData().then((data) => {
setEvents(data);
});
}, []);

return { events };
};

export default useEvents;
export default useEvents;

0 comments on commit 089b696

Please sign in to comment.