@@ -14,7 +14,6 @@ import {
1414 SIGNOUT_REQUEST_SENT ,
1515 SIGNOUT_REQUEST_SUCCEEDED ,
1616 SIGNOUT_REQUEST_FAILED ,
17- SET_HAS_VERIFICATION_BEEN_ATTEMPTED ,
1817} from '../../types'
1918import initialState from '../../initial-state'
2019
@@ -32,30 +31,23 @@ const currentUser = (state: User = initialUser, action: ReduxAction): User => {
3231 ...state ,
3332 isLoading : true ,
3433 }
35- case VERIFY_TOKEN_REQUEST_SUCCEEDED :
36- return {
37- ...state ,
38- attributes : { ...action . payload . userAttributes } ,
39- isLoading : false ,
40- isSignedIn : true ,
41- hasVerificationBeenAttempted : true ,
42- }
4334 case REGISTRATION_REQUEST_SUCCEEDED :
35+ case VERIFY_TOKEN_REQUEST_SUCCEEDED :
36+ const { userAttributes } = action . payload
37+ return {
38+ ...state ,
39+ attributes : { ...userAttributes } ,
40+ isLoading : false }
4441 case SIGNIN_REQUEST_SUCCEEDED :
42+ const { userAttributes } = action . payload
4543 return {
4644 ...state ,
47- attributes : { ...action . payload . userAttributes } ,
45+ attributes : { ...userAttributes } ,
4846 isLoading : false ,
4947 isSignedIn : true ,
5048 }
51- case VERIFY_TOKEN_REQUEST_FAILED :
52- return {
53- ...state ,
54- isLoading : false ,
55- isSignedIn : false ,
56- hasVerificationBeenAttempted : true ,
57- }
5849 case REGISTRATION_REQUEST_FAILED :
50+ case VERIFY_TOKEN_REQUEST_FAILED :
5951 case SIGNIN_REQUEST_FAILED :
6052 return {
6153 ...state ,
@@ -84,11 +76,6 @@ const currentUser = (state: User = initialUser, action: ReduxAction): User => {
8476 ...state ,
8577 isLoading : false ,
8678 }
87- case SET_HAS_VERIFICATION_BEEN_ATTEMPTED :
88- return {
89- ...state ,
90- hasVerificationBeenAttempted : action . payload . hasVerificationBeenAttempted ,
91- }
9279 default :
9380 return state
9481 }
0 commit comments