-
-
Save AllGistsEqual/0ce221e3970cf3d4fadb73b8f926268d to your computer and use it in GitHub Desktop.
This file contains 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
const userReducer = createReducer(initialState, builder => { | |
builder | |
.addCase(attemptLogin, state => ({ | |
...state, | |
loginState: 'loading', | |
message: 'loading', | |
})) | |
.addCase(setLogin, (state, action) => { | |
const { email, newUser } = action.payload | |
return { | |
login: true, | |
email, | |
newUser, | |
} | |
}) | |
.addCase(setLogout, (state, action) => { | |
const { loginState = 'loggedOut', message } = action.payload | |
return { | |
login: false, | |
loginState, | |
message, | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment