Skip to content

Commit

Permalink
fix(authReducer): Retrieve user from Redux, work #4
Browse files Browse the repository at this point in the history
  • Loading branch information
bip12 committed Jan 9, 2022
1 parent 1018bf5 commit 58bc1a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions application/src/redux/reducers/authReducer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { LOGIN, LOGOUT } from '../actions/types'

const INITIAL_STATE = { email: null, token: null };
const INITIAL_STATE = { email: '', token: null };

export default (state = INITIAL_STATE, action) => {
switch (action.type) {
case LOGIN:
return { ...state, email: action.payload.login, token: action.payload.token }
return { ...state, email: action.payload.email, token: action.payload.token } //payload.login -> payload.email

case LOGOUT:
return { ...state, ...INITIAL_STATE }
default:
Expand Down

0 comments on commit 58bc1a6

Please sign in to comment.