let BackEnd_url = `http://${process.env.REACT_APP_SERVER_MARKETPLACE_URL}`;
export const getSortedAssets = async (category: any, orders: any) => {
  try {
    const response = await fetch(
      `${BackEnd_url}/api/v1/categoryWise/${category}?sortBy=${orders}`,
      {
        method: "GET",
        headers: {
          "Content-Type": "application/json",
        },
      }
    );

    if (!response.ok) {
      throw new Error(`Error: ${response.statusText}`);
    }

    const result = await response.json();

    return result; // Return the result to be used later
  } catch (error: any) {
    console.error("Error fetching category:", error.message);
    throw new Error(error.message);
  }
};
