Untitled

mail@pastecode.io avatarunknown
tsx
2 months ago
597 B
8
Indexable
Never
import api from '@/services/apiServcie';
import { BookType } from '@/types/routes/global/book.type';
import { AxiosResponse } from 'axios';

type AxiosResponseType = BookType[];

export const APIfetchSimilarBooks = async (args: {
  categoryName: string;
}): Promise<AxiosResponseType> => {
  const {
    data: { data },
  }: AxiosResponse<{ data: AxiosResponseType }> = await api.post(
    '/similarBooksListAPI',
    {
      pageNumber: 0,
      category: args.categoryName,
    },
    {
      headers: { 'Content-Type': 'application/json' },
    },
  );
  return data;
};