I am trying to use the spread properties in my reducers, but it is coming back with an invalid syntax error. My build supports the use of the spread operator as I only get the error in my reducers.
auth_types.js
export const AUTH_USER = 'AUTH_USER'
export const UNAUTH_USER = 'UNAUTH_USER'
auth_actions.js
import { AUTH_USER, UNAUTH_USER } from './auth_types'
export function signinUser({ email, password }) {
return function(dispatch) {
axios.post(`${ROOT_URL}/signin`, { email, password })
.then(response => {
dispatch({ type: AUTH_USER })
browserHistory.push('/feature')
})
}
}
reducer.js
import { AUTH_USER, UNAUTH_USER } from '../actions/auth_types'
export default function(state = {}, action) {
switch(action.type) {
case AUTH_USER:
return { ...state, authenticated: true }
case UNAUTH_USER:
return { ...state, authenticated: false }
}
return state
}