๐Ÿ“ฆ obafemitayor / newsletter-subscription-application

๐Ÿ“„ category.ts ยท 8 lines
1
2
3
4
5
6
7
8import axios from 'axios';
import type { Category } from '../types/types';
import { BASE_URL } from '../helpers/constants';

export const fetchCategories = async (): Promise<Category[]> => {
  const { data } = await axios.get(`${BASE_URL}/categories`);
  return data.categories;
};