Skip to content

Commit

Permalink
firestore error catching, macos
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmajh committed Apr 12, 2024
1 parent 1bb3ac5 commit c8aabb1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion assets/firestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Firestore {
constructor(){
this.#fireApp = initializeApp(CONSTANTS.FIREBASECONFIG);
this.#fireDB = getFirestore(this.#fireApp);
console.log("firestore initialized");
}


Expand All @@ -29,10 +30,14 @@ class Firestore {
console.log("firestore is not initialized");
return;
}
try{
const fireRef = await addDoc(collection(this.#fireDB, 'events'), {
time: Date.now(), user: process.env.USERNAME, ...data,
time: Date.now(), user: process.env.USERNAME || process.env.USER , ...data,
});
console.log("added: " + fireRef.id);
} catch(e) {
console.error(e);
}
}
}

Expand Down

0 comments on commit c8aabb1

Please sign in to comment.