import {combineReducers} from 'redux';

import authSlice from './authSlice';


let appReducer = combineReducers({
  Auth: authSlice,
});

// export all action
export * from './authSlice';

const rootReducer = (state: any, action: any) => {
  if (action?.type === 'drawer/logoutUserSuccess') {
    state = {
      Auth: {
        user: {
          data: undefined,
          isLoading: false,
          errors: '',
        },
      },
    };
  }

  return appReducer(state, action);
};

export default rootReducer;
