Browse Source

fix mobyt fetching

Olivier Massot 2 years ago
parent
commit
a1b4fed9c1
2 changed files with 5 additions and 8 deletions
  1. 0 2
      components/Layout/Subheader.vue
  2. 5 6
      pages/subscription.vue

+ 0 - 2
components/Layout/Subheader.vue

@@ -70,8 +70,6 @@ Contient entre autres le breadcrumb, les commandes de changement d'année et les
         () => hasMenu('Main') || (accessProfile.isTeacher ?? false)
     )
 
-    console.log(accessProfile.historical.dateStart)
-
     const showDateTimeRange: Ref<boolean> = ref(
         Object.hasOwn(accessProfile.historical, 'dateStart') && accessProfile.historical.dateStart !== null &&
         Object.hasOwn(accessProfile.historical, 'dateEnd') && accessProfile.historical.dateEnd !== null

+ 5 - 6
pages/subscription.vue

@@ -309,12 +309,11 @@ Page 'Mon abonnement'
 
   const { data: dolibarrAccount, pending: dolibarrPending } = fetch(DolibarrAccount, organizationProfile.id)
 
-  if (ability.can('manage', 'texto')) {
-    const {data: mobytStatus, pending: mobytPending} = fetch(MobytUserStatus, organizationProfile.id)
-  } else {
-    const mobytStatus = ref(null)
-    const mobytPending = ref(false)
-  }
+  const mobytFetch = ability.can('manage', 'texto') ?
+      fetch(MobytUserStatus, organizationProfile.id) :
+      { data: ref(false), pending: ref(false) }
+
+  const { data: mobytStatus, pending: mobytPending } = mobytFetch
 
   const formatCurrency = (value: Number, currency: string): string => {
     return value.toLocaleString(i18n.locale.value, { style: 'currency', currency: currency })