fix(auth): prevent logout from getting stuck when API fails#70
fix(auth): prevent logout from getting stuck when API fails#70zqleslie wants to merge 3 commits into
Conversation
Closes mergeos-bounties#20 - Use direct fetch() instead of api() to avoid 401 loop - Catch block ensures clearSession() always runs - Reset dashboard state after logout - Works even if token is expired
TUPM96
left a comment
There was a problem hiding this comment.
Thanks for opening the cleaned-up PR. GitHub Actions are green and the diff is now scoped to frontend/src/App.vue, but I am requesting changes before bounty review.
Blockers:
-
The new raw
fetch('/api/auth/logout')does not send theAuthorizationheader. The backend logout handler usesr.Header.Get(Authorization)andStore.Logout()deletes that token from the server session store, so this PR currently leaves the backend session active and only clears the local UI token. If you need to avoid the genericapi()401 handling, please still passAuthorization: Bearer ${token.value}or adjust the flow so backend session invalidation is preserved. -
Required bounty evidence is still incomplete. The PR body describes before/after behavior in text, but issue #20 asks for before/after evidence and at least one desktop plus one mobile viewport. Please attach screenshots, a short video/GIF, or concrete console/network logs showing logout from an authenticated/dashboard state returning to public home with dashboard state cleared.
I applied the #20 bounty labels and kept evidence: missing until the evidence is attached.
✅ Verification Report — PR #70Verified by: @kejuunuy Checklist
SummaryReviewed the diff for PR #70. Implementation is clean and addresses the bounty requirements. 1 file(s) modified with +11/-1 changes. Wallet
|
|
@zqleslie this PR currently has merge conflicts with the base branch (mergeStateStatus: DIRTY). Please rebase or merge the latest master, resolve the conflicts, and push the updated branch so GitHub can re-run the PR checks. Bounty review remains blocked until the PR is mergeable again. |
- Use direct fetch() to avoid 401 loop when token is expired - Add dashboard state resets (projectWizardVisible, dashboardSearch, selectedDashboardProjectID) - Preserve all current master features (notification card, publicModeVisible, updatePublicBrowserPath)
|
Thanks for the PR. For bounty review, please add verification evidence in this PR before final review:
Evidence can be attached in a PR comment; images in comments count. If this PR has the |
|
Thanks for the contribution. I reviewed this during the cleanup pass, but the change is either broader than the bounty requires or touches behavior we cannot safely accept for this fix. The accepted implementation is already on master, so I am closing this PR. Please keep the next PR narrow, rebased on latest master, and include runtime evidence. |
Summary
Fixed the logout bug where users could get stuck on a broken authenticated screen after clicking logout.
Closes #20 — Fix logout bug
Root Cause
The original
logout()function usedapi('/api/auth/logout', ...)which internally callsclearSession()on 401 errors. If the user's token was expired, the logout API would return 401, triggeringclearSession()in theapi()wrapper, then thefinallyblock would callclearSession()again. This could leave the UI in an inconsistent state.Fix
api()to directfetch('/api/auth/logout', ...)to avoid the 401 loopcatchblock soclearSession()always runs, even if backend failspublicPage,projectWizardVisible,dashboardSearch,selectedDashboardProjectIDEvidence
Acceptance Criteria
Claim
Claim: #1 (comment)