return success/error result from signOut instead of silently swa… - #346
Open
khushboo-khatoon wants to merge 1 commit into
Open
return success/error result from signOut instead of silently swa…#346khushboo-khatoon wants to merge 1 commit into
khushboo-khatoon wants to merge 1 commit into
Conversation
|
@khushboo-khatoon is attempting to deploy a commit to the Nitya Gosain's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
hey @Nitya-003 , PR is now ready to review and merge . thank u ( : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
signOut() failure is silently swallowed with no user feedback
Fixes #342
Description
Previously,
signOut()in theuseAuthhook caught any error fromfirebaseSignOutand only logged it to the console. It didn't return anything, throw, or expose any error state to the caller — so any UI component callingsignOut()had no way to know whether sign-out actually succeeded or failed.This meant that if
firebaseSignOutfailed (e.g. due to a network issue), the app could still proceed as if the user had successfully signed out, even though they remained authenticated — a security/trust concern, especially on shared devices.Changes
signOut()now returnsPromise<{ success: boolean; error?: unknown }>instead of returning nothing.{ success: true }.{ success: false, error }.{ success: false }for a consistent return shape across all code paths.File
frontend/hooks/useAuth.tsBefore
After
Note
signOut()isn't currently called anywhere in the codebase yet (verified via a full search — no "Sign Out" UI exists at this time). This fix ensuressignOut()returns a proper{ success, error }result so that whenever a Sign Out UI is implemented in the future, the calling component can immediately show appropriate feedback (e.g. a toast on failure) instead of silently assuming success.How to Test
signOut()from a test component or the browser console after import, and confirming:{ success: true }.firebaseSignOutto reject) resolves with{ success: false, error }instead of throwing or resolving withundefined.Impact
Ensures that once a Sign Out feature is built, users will always receive accurate feedback about whether they were actually signed out, preventing a scenario where a user believes they're logged out on a device while still authenticated.
Checklist
signOut()has no existing callers to update