add: company info & edit company view

This commit is contained in:
Alexandro Uc Santos
2023-11-29 21:07:46 -06:00
parent dd674b053b
commit df8aff2745
18 changed files with 548 additions and 48 deletions

View File

@@ -0,0 +1,34 @@
import { ref } from "vue";
import { getCompany } from "../services/company";
import {useAuthStore} from '../stores/auth'
import { useCompanyStore } from "../stores/company";
export default function useCompany() {
const auth = useAuthStore();
const companyStore = useCompanyStore();
const loading = ref(false);
const company = ref(null);
const getCompanyData = async() => {
if(companyStore.company === null) {
loading.value = true;
const companyId = auth.user.company;
console.log(companyId)
const resp = await getCompany(companyId);
companyStore.company = resp;
company.value = resp;
loading.value = false;
} else {
company.value = companyStore.company;
}
}
return {
getCompanyData,
loading,
company
}
}