import {
  actionGetChatsSuccess,
  actionGetChatsReject,
} from '../action';
import { getChats} from '../../../api-data';
import { IChatsRes } from '../../../typescript/redux/chats/interfaces'

const asyncGetChats = () => async (dispatch:any) => {
  try {
    const data = await getChats<IChatsRes>()
    data&&dispatch(actionGetChatsSuccess(data))
  } catch (e) {
    dispatch(actionGetChatsReject())
  }
};

export { asyncGetChats };




