import axios from "axios";
import { baseUrl } from "../../constants/urls";
import { Axios } from "../../config/Axios";

export const fetchCategory = async () => {
  const url = `${baseUrl}/api/root-categories-list`;
  const config = {
		method: 'GET',
		url: url,
		headers: {
      'responseType': 'blob',
		}
	};
  const category_res = await axios(config);
  
  return category_res.data;
};

export const fetchHomeCategory = async () => {
  const url = `${baseUrl}/api/home-root-categories-list`;
  const config = {
		method: 'GET',
		url: url,
		headers: {
      'responseType': 'blob',
		}
	};
  const category_res = await axios(config);
  
  return category_res.data;
};


export const fetchCategoryTree = async () => {
  const url = `${baseUrl}/api/categories-tree-view`;
  const category_res = await Axios.get(url);
  return category_res.data;
};

export const brandsList = async () => {
  const url = `${baseUrl}/api/brands-list`;
  const config = {
    method: "GET",
    url: url,

    headers: {
      Accept: "application/json",
    },
  };
  const brands = await axios(config);

  return brands.data;
};
