import { AxiosResponse } from 'axios' ; import { makeRequest } from '../makeRequest' ; import { IComment } from '../../types/redux/comments-reducer-types' ; EXPORTS export { getAllApprovedCommentsFromDB , persistNewCommentToDB } ; api function returns { object } const getAllApprovedCommentsFromDB = ( ) : Promise < AxiosResponse < { success : boolean ; total : number ; comments : IComment [ ] ; } > > => { return makeRequest ( { url : '/api/comments/' , method : 'GET' , } ) ; } ; api function returns { object } const persistNewCommentToDB = ( newComment ) : Promise < AxiosResponse < { success : boolean ; } > > => { return makeRequest ( { url : '/api/comments' , method : 'POST' , data : newComment , headers : { 'Content-Type' : 'application/json' } , } ) ; } ;