export default function promiseReducer(state = {}, { type, name, status, payload, error }) {
    if (type === "PROMISE") {
        return {
            ...state,
            [name]: { status, payload, error },
        };
    }
    // if (type === "MSG") {
        

    //     if (payload && payload.length > 0) {
    //         const chatId = payload[0]?.chat?._id;

    //         const newState = {
    //             ...state,
    //             [chatId]: {
    //                 ...state[chatId]
    //             },
    //         };

    //         return newState;
    //     }
    //     return state;
    // }
    
    return state;
}