Browse Source

minor fix

Vincent GUFFON 4 years ago
parent
commit
c4cdac10ad

+ 4 - 4
components/Layout/AlertBar/SwitchYear.vue

@@ -14,14 +14,14 @@ Switch year bar : Barre qui s'affiche lorsque l'utilisateur n'est pas sur l'ann
 <script lang="ts">
 import { defineComponent, useContext, computed} from '@nuxtjs/composition-api'
 import {accessState, organizationState} from "~/types/interfaces";
-import {$useDirtyForm} from "~/use/form/useDirtyForm";
+import {$useForm} from "~/use/form/useForm";
 import {$useMyProfileUpdater} from "~/use/updater/useMyProfileUpdater";
 
 export default defineComponent({
   setup () {
-    const { store, $dataPersister } = useContext()
-    const { markFormAsNotDirty } = $useDirtyForm(store)
-    const { updateMyProfile, setHistorical, setActivityYear } = $useMyProfileUpdater(store, $dataPersister)
+    const { store } = useContext()
+    const { markFormAsNotDirty } = $useForm()
+    const { updateMyProfile, setHistorical, setActivityYear } = $useMyProfileUpdater()
 
     const profileAccess:accessState = store.state.profile.access
     const profileOrganization:organizationState = store.state.profile.organization

+ 6 - 2
components/Layout/Header/Notification.vue

@@ -73,7 +73,7 @@
 </template>
 
 <script lang="ts">
-import {computed, ComputedRef, defineComponent, Ref, ref, useContext, useFetch, useStore, watch} from '@nuxtjs/composition-api'
+import {computed, ComputedRef, defineComponent, onUnmounted, Ref, ref, useContext, useFetch, useStore, watch} from '@nuxtjs/composition-api'
 import {NOTIFICATION_TYPE, QUERY_TYPE} from "~/types/enums";
 import {Notification} from "~/models/Core/Notification";
 import {repositoryHelper} from "~/services/store/repository";
@@ -178,12 +178,16 @@ export default defineComponent({
     /**
      * Dès l'ouverture du menu, on indique que les notifications non lues, le sont.
      */
-    watch(isOpen, (newValue, oldValue) => {
+    const unwatch = watch(isOpen, (newValue, oldValue) => {
       if(newValue){
         markNotificationsAsRead()
       }
     })
 
+    onUnmounted(() => {
+      unwatch()
+    })
+
     /**
      * Marque les notification non lues comme lues
      */

+ 4 - 0
components/Layout/Loading.vue

@@ -25,11 +25,15 @@ export default defineComponent({
     const finish = () => {
       loading.value = false
     }
+    const fail = () => {
+      loading.value = false
+    }
 
     return {
       loading,
       start,
       finish,
+      fail,
       set
     }
   }

+ 4 - 4
components/Layout/SubHeader/ActivityYear.vue

@@ -21,13 +21,13 @@
 import { defineComponent, useContext } from '@nuxtjs/composition-api'
 import { $useMyProfileUpdater } from '~/use/updater/useMyProfileUpdater'
 import { $organizationProfile } from '~/services/profile/organizationProfile'
-import { $useDirtyForm } from '~/use/form/useDirtyForm'
+import { $useForm } from '~/use/form/useForm'
 
 export default defineComponent({
   setup () {
-    const { store, $dataPersister } = useContext()
-    const { updateMyProfile, setActivityYear, activityYear } = $useMyProfileUpdater(store, $dataPersister)
-    const { markFormAsNotDirty } = $useDirtyForm(store)
+    const { store } = useContext()
+    const { updateMyProfile, setActivityYear, activityYear } = $useMyProfileUpdater()
+    const { markFormAsNotDirty } = $useForm()
 
     const organizationProfile = $organizationProfile(store)
 

+ 3 - 4
components/Layout/SubHeader/DataTiming.vue

@@ -26,14 +26,13 @@
 
 <script lang="ts">
 import { defineComponent, onUnmounted, ref, useContext, watch, Ref, WatchStopHandle } from '@nuxtjs/composition-api'
-import { $useDirtyForm } from '~/use/form/useDirtyForm'
+import { $useForm } from '~/use/form/useForm'
 import { $useMyProfileUpdater } from '~/use/updater/useMyProfileUpdater'
 
 export default defineComponent({
   setup () {
-    const { store, $dataPersister } = useContext()
-    const { markFormAsNotDirty } = $useDirtyForm(store)
-    const { updateMyProfile, setHistorical, historical } = $useMyProfileUpdater(store, $dataPersister)
+    const { markFormAsNotDirty } = $useForm()
+    const { updateMyProfile, setHistorical, historical } = $useMyProfileUpdater()
 
     const historicalBtn: Ref<Array<number>> = initHistoricalBtn(historical.value)
 

+ 3 - 4
components/Layout/SubHeader/DataTimingRange.vue

@@ -40,13 +40,12 @@ import {
   defineComponent, onUnmounted, ref, useContext, watch, computed, ComputedRef, Ref, WatchStopHandle
 } from '@nuxtjs/composition-api'
 import { $useMyProfileUpdater } from '~/use/updater/useMyProfileUpdater'
-import { $useDirtyForm } from '~/use/form/useDirtyForm'
+import { $useForm } from '~/use/form/useForm'
 
 export default defineComponent({
   setup (_, { emit }) {
-    const { store, $dataPersister } = useContext()
-    const { markFormAsNotDirty } = $useDirtyForm(store)
-    const { updateMyProfile, setHistoricalRange, historical } = $useMyProfileUpdater(store, $dataPersister)
+    const { markFormAsNotDirty } = $useForm()
+    const { updateMyProfile, setHistoricalRange, historical } = $useMyProfileUpdater()
 
     const datesRange:ComputedRef<Array<string>> = computed(() => {
       return [historical.value.dateStart, historical.value.dateEnd]