Skip to content
Closed
Show file tree
Hide file tree
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
14 changes: 6 additions & 8 deletions src/context/AuthContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ const checkAndUpdateStreak = async (data, docRef) => {
"points.streakPoints": newStreakPoints,
"points.totalPoints": newTotalPoints
});
console.log("Streak updated successfully. New Streak:", newStreak, "| Longest:", newLongestStreak);
} catch (err) {
console.error("Failed to update streak:", err);
} catch {
// Silent failure for streak updates to avoid exposing internal errors
}
}
};
Expand Down Expand Up @@ -104,8 +103,8 @@ export const AuthProvider = ({ children }) => {
setIsOnboarding(true);
setLoading(false);
}
}, (error) => {
console.error("Real-time profile listener error:", error);
}, (_error) => {
// Silent error handling to avoid exposing internal system errors
setLoading(false);
});

Expand Down Expand Up @@ -175,7 +174,6 @@ export const AuthProvider = ({ children }) => {

return authUser;
} catch (error) {
console.error("Login service failure:", error);
setLoading(false);
throw error;
}
Expand All @@ -193,8 +191,8 @@ export const AuthProvider = ({ children }) => {
setUserData(null);
setIsOnboarding(false);
setGhAccessToken(null);
} catch (error) {
console.error("Logout failure:", error);
} catch {
// Silent error handling for logout
} finally {
setLoading(false);
}
Expand Down
20 changes: 5 additions & 15 deletions src/lib/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ const requiredConfigKeys = [

const hasRequiredConfig = requiredConfigKeys.every((key) => Boolean(firebaseConfig[key]));

if (!hasRequiredConfig) {
console.warn("Firebase is not configured. Auth, database, analytics, and storage services are disabled for this environment.");
}

// Initialize Firebase
const app = hasRequiredConfig ? initializeApp(firebaseConfig) : null;

Expand Down Expand Up @@ -73,8 +69,8 @@ let analyticsInstance = null;
if (app && typeof window !== "undefined") {
try {
analyticsInstance = getAnalytics(app);
} catch (error) {
console.warn("Analytics initialization skipped:", error);
} catch {
// Analytics initialization failed silently
}
}

Expand Down Expand Up @@ -113,9 +109,8 @@ export const signInWithGitHub = async (requestRepoScope = false) => {
lastLogin: new Date().toISOString(),
};

return { user, accessToken, userData, result };
return { user, accessToken, userData, result };
} catch (error) {
console.error("GitHub sign-in error:", error);
if (error.code === 'auth/account-exists-with-different-credential') {
throw new Error('An account already exists with the same email address.', { cause: error });
}
Expand All @@ -132,13 +127,8 @@ export const signOutUser = async () => {
return true;
}

try {
await signOut(auth);
return true;
} catch (error) {
console.error("Sign out error:", error);
throw error;
}
await signOut(auth);
return true;
};

// Helper function to get current user's token
Expand Down