source

Vuex 작업으로 종속성을 가져오는 방법

goodcode 2022. 7. 26. 23:38
반응형

Vuex 작업으로 종속성을 가져오는 방법

함수를 Vuex 작업으로 가져오는 올바른 방법은 무엇입니까?액션 코드에 Firebase를 Import하려고 하면 다음과 같은 eslint 오류가 나타나기 때문에 질문합니다.

'doc' is declared but its value is never read.ts(6133)
'doc' is defined but never used.eslintno-unused-vars
(alias) function doc(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData> (+2 overloads)
import doc

여기 있습니다.actions.js코드:

import { doc } from "firebase/firestore"
import {db} from '~/plugins/firebase.js'

export default {

async getUserProfile({ commit }, authUser) {
  try {
    const docRef = doc(db, 'users', authUser.uid) // <----trying to use `doc()` here but get that eslint error
    ....
   }
....
}

를 Import 할 수 없는 이유는 무엇입니까?doc()에 기능하다getUserProfile()액션?

스크린샷으로 업데이트됨:

eslint 오류

결국, 이것은 이 사실이 초래한 것이다.doc코멘트의 OP에 기재된 바와 같이 코드 후반부에서 (재) 선언되었습니다.따라서 ESlint가 사용되지 않은 변수에 대해 불만을 표시한 것입니다.

언급URL : https://stackoverflow.com/questions/68408282/how-to-import-dependency-into-vuex-actions

반응형