import {
  actionGetAllMessagesSuccess,
  actionGetAllMessagesReject,
} from '../action';
import { getAllMessages } from '../../../api-data';
import { IAllMessagesState } from '../../../typescript/redux/allMessages/interfaces'


const asyncGetAllMessages= () => async (dispatch:any) => {
  try {
    const data = await getAllMessages<IAllMessagesState>()
    data && dispatch(actionGetAllMessagesSuccess(data))
  } catch (e) {
    dispatch(actionGetAllMessagesReject())
  } 
};

export { asyncGetAllMessages };




