Vincent GUFFON 4 år sedan
förälder
incheckning
ec3f48b69f
1 ändrade filer med 5 tillägg och 6 borttagningar
  1. 5 6
      use/updater/useMyProfileUpdater.ts

+ 5 - 6
use/updater/useMyProfileUpdater.ts

@@ -1,4 +1,4 @@
-import { computed, ComputedRef } from '@nuxtjs/composition-api'
+import {computed, ComputedRef, useStore} from '@nuxtjs/composition-api'
 import { Item, Model } from '@vuex-orm/core'
 import { repositoryHelper } from '~/services/store/repository'
 import { QUERY_TYPE } from '~/types/enums'
@@ -18,8 +18,9 @@ export class UseMyProfileUpdater {
   private $dataPersister!:DataPersister
   private myProfile!:MyProfile
 
-  constructor (store:AnyStore, $dataPersister:DataPersister) {
-    this.store = store
+  constructor () {
+    this.store = useStore()
+    const {$dataPersister} = useContext()
     this.$dataPersister = $dataPersister
   }
 
@@ -27,8 +28,6 @@ export class UseMyProfileUpdater {
    * Composition function
    */
   public invoke (): AnyJson {
-
-    const {$ability} = useContext()
     const currentAccessId = $accessProfile(this.store).getCurrentAccessId()
 
     this.myProfile = this.getMyProfileInstance(currentAccessId) as MyProfile
@@ -112,4 +111,4 @@ export class UseMyProfileUpdater {
   }
 }
 
-export const $useMyProfileUpdater = (store:AnyStore, $dataPersister:DataPersister) => new UseMyProfileUpdater(store, $dataPersister).invoke()
+export const $useMyProfileUpdater = () => new UseMyProfileUpdater().invoke()