Skip to content

Commit

Permalink
fix: fetch error when there are no event ids (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
WelldoneM authored Nov 29, 2024
1 parent ea85aa0 commit 127f949
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/firebase/eventsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { db } from './firebaseConfig';
const fetchEventsByIds = async (
eventIds: string[]
): Promise<DonationEvent[]> => {
if (eventIds.length === 0) {
if (!eventIds?.length) {
console.info('No event IDs provided.');
return [];
}
Expand All @@ -27,7 +27,7 @@ const fetchEventsByIds = async (
const eventsCollection = collection(db, 'events');
const snapshot = await getDocs(eventsCollection);

if (snapshot.empty) {
if (!snapshot.docs?.length) {
console.info('No events found in the collection.');
return [];
}
Expand Down

0 comments on commit 127f949

Please sign in to comment.