feat: implement logout functionality#52
Merged
ayshadogo merged 3 commits intoDfunder:mainfrom Mar 6, 2026
Merged
Conversation
- Add logoutUser thunk handlers to authSlice with pending/fulfilled/rejected states - Integrate Redux in Navbar component to manage user authentication state - Implement logout flow: dispatch thunk, clear state, redirect to login with toast - Add loading state and disabled UI for logout button during processing - Handle logout failures gracefully by clearing local state anyway - Update both desktop and mobile sign out buttons with proper UX
Resolved conflicts in authSlice.js by combining logout thunk handlers with existing auth handlers (registerUser, loginUser, verifyEmail, resendEmailVerification, forgotPassword). Both feature branches are now integrated.
- Remove unused 'result' variable from logoutUser dispatch - Remove unused 'error' parameter from catch block - Simplify error handling since we handle all cases identically
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.
Logout Functionality Implementation
Overview
This PR implements the complete logout flow for the StellarAid application. Users can now sign out from both desktop and mobile interfaces with a seamless experience.
Changes
1. authSlice.js - Redux State Management
logoutUserasync thunkextraReducersto handle logout thunk states:isLoadingtotruewhile processing logout request2. Navbar.jsx - UI Integration & Logout Flow
useAuthmock hookuseAppDispatchanduseAppSelectorselectCurrentUserselector for user statelogoutUserasync thunk from authThunkstoastSuccessutility for user notificationshandleLogoutfunction:logoutUser()thunk which callsPOST /api/auth/logout/loginpageisLoggingOutstate to track logout progressAcceptance Criteria ✅
logoutUser()thunk which callsPOST /api/auth/logout/loginwith success toast messageTesting Notes
Files Modified
src/components/layout/Navbar.jsx- UI and logout handlersrc/features/auth/authSlice.js- Redux thunk handlingDependencies
@reduxjs/toolkit- Already in use for Redux setupreact-hot-toast- Already in use for toast notificationsreact-router-dom- Already in use for navigationcloses #31