From 948ba588eba5b69ad006e1cd5be2e2f2631b187c Mon Sep 17 00:00:00 2001 From: Alexandro Uc Santos Date: Mon, 4 Mar 2024 21:29:12 -0600 Subject: [PATCH] close sesion question added --- src/components/Sidebar.vue | 22 ++++++++++++++-------- src/components/ui/EditCompanyModal.vue | 3 --- src/stores/company.js | 1 + src/views/MyCompanyView.vue | 14 +++++++++++++- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index 796ad1f..32c6efa 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -1,20 +1,26 @@ diff --git a/src/components/ui/EditCompanyModal.vue b/src/components/ui/EditCompanyModal.vue index 3a6588b..daa6a08 100644 --- a/src/components/ui/EditCompanyModal.vue +++ b/src/components/ui/EditCompanyModal.vue @@ -12,9 +12,6 @@ const companyStore = useCompanyStore() const notifications = useNotificationsStore() - - console.log(companyStore.company?.categories); - const loading = ref(false); const msgError = ref(''); const companyCategories = ref([]); diff --git a/src/stores/company.js b/src/stores/company.js index f7908b8..86a9e2b 100644 --- a/src/stores/company.js +++ b/src/stores/company.js @@ -25,6 +25,7 @@ export const useCompanyStore = defineStore('company', () => { const getCompanyData = async() => { const companyId = localStorage.getItem('id'); + console.log({companyId}); loading.value = true; if(!company.value) { loading.value = true; diff --git a/src/views/MyCompanyView.vue b/src/views/MyCompanyView.vue index 763a5ef..2f6da60 100644 --- a/src/views/MyCompanyView.vue +++ b/src/views/MyCompanyView.vue @@ -6,16 +6,28 @@ import {getTypeCompany} from '../helpers/type_company' import {getDateMonthDay} from '../helpers/date_formats' import EditCompanyModal from '../components/ui/EditCompanyModal.vue'; +import { storeToRefs } from 'pinia'; const auth = useAuthStore() const company = useCompanyStore(); + const { user, authStatus } = storeToRefs(auth); + onMounted(() => { - getInitialData() + if(user.value) { + getInitialData() + } }); + watch(user, () => { + if(user.value) { + getInitialData(); + } + }) + const getInitialData = async() => { await auth.authenticationPromise; + // await authenticationPromise; await company.getCompanyData(); }