Redux - Use a Switch Statement to Handle Multiple Actions

Tell us what’s happening:

Can somebody tell me what is wrong , according to the console the dispatching is not working but i can’t figure out why

Your code so far

const defaultState = {
  authenticated: false
};

const authReducer = (state = defaultState, action) => {
  // Change code below this line
switch (action.type){
case 'LOGIN':
    return{
    authenticated: true
    };
case 'LOGOUT':
   return {
     authenticated: false
     };
default: {
  return defaultState;
}
  // Change code above this line
};

const store = Redux.createStore(authReducer);

const loginUser = () => {
  return {
    type: 'LOGIN'
  }
};

const logoutUser = () => {
  return {
    type: 'LOGOUT'
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0

Challenge Information:

Redux - Use a Switch Statement to Handle Multiple Actions

look at the console, you have a syntax error

1 Like

Thank You very much i’ve been looking at it for half an hour ;-;