add: view carriers

This commit is contained in:
Alexandro Uc Santos
2023-12-01 21:32:13 -06:00
parent df8aff2745
commit 85095bda36
8 changed files with 335 additions and 10 deletions

View File

@@ -0,0 +1,29 @@
import { ref } from "vue";
import { getCompanies } from '../services/public';
export default function useDirecty() {
const companies = ref([]);
const loading = ref(false);
const getCompaniesData = async(filterQuery) => {
let filterArr = Object.values(filterQuery);
let cleanfilterArr = filterArr.filter(n=>n);
let filterStr = "";
if(cleanfilterArr.length >0){
filterStr = cleanfilterArr[0] + "?"
filterStr += cleanfilterArr.slice(1).join("&");
}
loading.value = true;
const resp = await getCompanies(filterStr);
companies.value = resp;
loading.value = false;
}
return {
getCompaniesData,
loading,
companies
}
}