Skip to content

Commit

Permalink
profile again update
Browse files Browse the repository at this point in the history
  • Loading branch information
thakiyudheen committed Jul 15, 2024
1 parent 2b15714 commit f662d7a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/redux/store/slices/userSlice .ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { signupAction } from '../actions/auth/signupAction';
import { getUserDataAction } from '../actions/auth/getUserDataAction';
import { logoutAction } from '../actions/auth/logoutAction';
import { loginUserAction } from '../actions/auth/loginUserAction';
import { updateUserAction } from '../actions/user/updateUserAction';

export interface UserState {
loading: boolean;
Expand Down Expand Up @@ -102,6 +103,24 @@ const userSlice = createSlice({
state.error = action.error.message || 'Login failed';
})

// update data handle -----------------------------------------

.addCase(updateUserAction.pending , (state : UserState) =>{
console.log('update user is working')
state.loading = true;
state.error = null;
})
.addCase(updateUserAction.fulfilled , (state : UserState , action : PayloadAction<SignupFormData>) =>{
state.loading = false;
state.data = action.payload;
state.error = null;
})
.addCase(updateUserAction.rejected,(state : UserState , action ) =>{
state.loading = true ;
state.data =null ;
state.error = action.error.message || 'updation failed';
})

},
});

Expand Down

0 comments on commit f662d7a

Please sign in to comment.