Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ export default function App() {

const unsubscribe = onAuthStateChanged(auth, async (firebaseUser) => {
setUser(firebaseUser);
setAuthLoading(false);
if (firebaseUser) {
// Fetch API key from Firestore
// Fetch API key from Firestore before revealing the app
try {
const snap = await getDoc(doc(db, "users", firebaseUser.uid));
if (snap.exists() && snap.data().apiKey) {
Expand All @@ -80,6 +79,7 @@ export default function App() {
} else {
setApiKey("");
}
setAuthLoading(false);
});
return () => unsubscribe();
}, []);
Expand Down