//import promiseReducer from "./promiseReducer";
import authReducer from "./authReducer";
import {createStore, combineReducers, applyMiddleware} from "redux";
import thunk from "redux-thunk";


function promiseReducer(state = {}, { type, status, payload, error, name }) {
    if (type === 'PROMISE') {
        return {
            ...state,
            [name]: { status, payload, error }
        }
    }
    return state;
}


export const store = createStore(
	combineReducers({promise: promiseReducer, auth: authReducer}),
	applyMiddleware(thunk)
);