瀏覽代碼

improve lodash imports and minor fixes

Olivier Massot 2 年之前
父節點
當前提交
fe6b36e9ef

+ 8 - 6
components/Layout/Alert/Container.vue

@@ -4,12 +4,14 @@ Container principal pour l'affichage d'une ou plusieurs alertes
 
 <template>
   <main class="alertContainer">
-    <LayoutAlertContent
-      v-for="(alert, key) in alerts"
-      :key="key"
-      class="alertContent"
-      :alert="alert"
-    />
+    <client-only>
+      <LayoutAlertContent
+        v-for="(alert, key) in alerts"
+        :key="key"
+        :alert="alert"
+        class="alertContent"
+      />
+    </client-only>
   </main>
 </template>
 

+ 3 - 1
components/Layout/Alert/Content.vue

@@ -17,7 +17,9 @@
         {{ $t(message) }}
       </li>
     </ul>
-    <span v-else>{{ $t(props.alert.messages[0]) }}</span>
+    <span v-else>
+        {{ $t(props.alert.messages[0]) }}
+    </span>
   </v-alert>
 </template>
 

+ 3 - 0
components/Layout/AlertBar/Cotisation.vue

@@ -93,6 +93,9 @@ if (cotisation.value !== null) {
   alert.value = mapping[cotisation.value.alertState as ALERT_STATE_COTISATION]
 }
 
+
+
+
 </script>
 
 <style scoped lang="scss">

+ 6 - 3
components/Layout/SubHeader/ActivityYear.vue

@@ -1,6 +1,9 @@
 <template>
   <main class="d-flex flex-row align-center">
-    <span v-show="mdAndUp" class="mr-2 font-weight-bold on-neutral">{{ $t(label) }} : </span>
+    <span v-show="mdAndUp"
+          class="mr-2 font-weight-bold on-neutral">
+        {{ $t(label) }} :
+    </span>
 
     <UiXeditableText
       class="activity-year-input"
@@ -39,7 +42,7 @@ const organizationProfileStore = useOrganizationProfileStore()
 const formStore = useFormStore()
 const { mdAndUp } = useDisplay()
 
-const currentActivityYear: Ref<number | null> = ref(accessProfileStore.activityYear)
+const currentActivityYear: Ref<number | undefined> = ref(accessProfileStore.activityYear ?? undefined)
 const yearPlusOne: boolean = !organizationProfileStore.isManagerProduct
 const label: string = organizationProfileStore.isSchool ? 'schooling_year' : organizationProfileStore.isArtist ? 'season_year' : 'cotisation_year'
 
@@ -52,7 +55,7 @@ const setActivityYear = async (activityYear: number) => {
     throw new Error("Error: 'year' shall be a valid year")
   }
   if (accessProfileStore.id === null) {
-    throw new Error("Error: invalide access id")
+    throw new Error("Error: invalid access id")
   }
   formStore.setDirty(false)
 

+ 2 - 1
composables/form/useFieldViolation.ts

@@ -1,5 +1,6 @@
 import {computed, ComputedRef} from "@vue/reactivity";
 import {useFormStore} from "~/stores/form";
+import * as _ from 'lodash'
 
 /**
  * Composable pour gérer l'apparition de message d'erreurs de validation d'un champ de formulaire
@@ -8,7 +9,7 @@ import {useFormStore} from "~/stores/form";
  */
 export function useFieldViolation(field: string) {
   const fieldViolations: ComputedRef<string> = computed(()=> {
-    return useGet(useFormStore().violations, field, '')
+    return _.get(useFormStore().violations, field, '')
   })
 
   /**

+ 1 - 1
nuxt.config.ts

@@ -106,7 +106,7 @@ export default defineNuxtConfig({
         '@pinia-orm/nuxt',
         '@nuxtjs/i18n',
         '@nuxt/image-edge',
-        '@nuxt/devtools'
+        // '@nuxt/devtools'
     ],
     vite: {
         esbuild: {

+ 1 - 1
services/layout/menuBuilder/myAccessesMenuBuilder.ts

@@ -1,7 +1,7 @@
 import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
 import {MenuGroup, MenuItems} from "~/types/layout";
 import {MENU_LINK_TYPE} from "~/types/enum/layout";
-import _ from "lodash"
+import * as _ from 'lodash'
 
 /**
  * Menu Mon Profil

+ 1 - 1
services/layout/menuBuilder/myFamilyMenuBuilder.ts

@@ -1,7 +1,7 @@
 import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
 import {MenuGroup, MenuItems} from "~/types/layout";
 import {MENU_LINK_TYPE} from "~/types/enum/layout";
-import _ from "lodash"
+import * as _ from 'lodash'
 
 /**
  * Menu Famille

+ 1 - 1
services/layout/menuBuilder/websiteListMenuBuilder.ts

@@ -1,7 +1,7 @@
 import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
 import {MenuGroup, MenuItems} from "~/types/layout";
 import {MENU_LINK_TYPE} from "~/types/enum/layout";
-import _ from "lodash"
+import * as _ from 'lodash'
 
 /**
  * Menu : Liste des sites internet de la structure et de ses structures parentes

+ 1 - 1
services/rights/abilityBuilder.ts

@@ -3,7 +3,7 @@ import {AbilitiesType} from '~/types/interfaces'
 import {MongoAbility} from "@casl/ability/dist/types/Ability";
 import {ABILITIES} from "~/types/enum/enums";
 import yaml from "yaml-import";
-import _ from "lodash"
+import * as _ from 'lodash'
 
 interface Condition {
     function: string

+ 1 - 1
services/rights/roleUtils.ts

@@ -1,6 +1,6 @@
 import { AbilitiesType } from '~/types/interfaces'
 import {AnyJson} from "~/types/data"
-import _ from "lodash"
+import * as _ from 'lodash'
 
 // TODO: peut-être passer ces constantes dans la config?
 const rolesByFunction: Array<string> = [