import { getRequest } from "@/api/customFetch";
import { getTravelList } from "@/api/interfaceDocument";

export const useTravelList = () => {
  const travelList = ref<any[]>([]);
  const travelCategory = ref<any[]>([]);

  getRequest(getTravelList()).then((resp) => {
    if (resp.code === 200) {
      travelList.value = (resp.result as { data:{products: any[]} }).data.products;
      travelCategory.value = (resp.result as {data: {categories: any[]} }).data.categories.map((item,index) => ({title:item,paneKey:index.toString()}));
    }
  });

  return { travelList,travelCategory };
};
