import {configureStore} from '@reduxjs/toolkit';
import AuthenticationReducer from './slices/Authentication.slice';
import ChannelsReducer from './slices/Channels.slice';
import ChannelsPublishingReducer from './action/channels-publishing';
import ScreensReducer from './action/screens';
import {authenticateRequestMiddleware, loggerMiddleware, vanillaPromiseMiddleware} from './middlewares';

const store = configureStore({
  reducer: {
    authentication: AuthenticationReducer,
    channels: ChannelsReducer,
    channelsPublishing: ChannelsPublishingReducer,
    screens: ScreensReducer
  },
  middleware: getDefaultMiddleware =>
    getDefaultMiddleware({
      thunk: true,
      serializableCheck: false
    }).concat(authenticateRequestMiddleware, vanillaPromiseMiddleware, loggerMiddleware)
});

export default store;
