首页 > 解决方案 > "this.apollo is undefined" & "Cannot read property 'use' of undefined" when the query is moved to a separate Angular package

问题描述

I used to have this graphql query inside my Angular app which used to work properly. Now that I have moved it to an external library, I get the following error in my chrome console:

application.js:198 TypeError: Cannot read property 'use' of undefined
    at FetchIntegrationsInformationGQL../node_modules/apollo-angular/fesm5/ngApollo.js.Query.fetch (ngApollo.js:260)

Other browser:

TypeError: "this.apollo is undefined"
query FetchIntegrationsInformation(
  $accountPk: PK!
  $workspacePk: PK!
) {
  currentUser {
    id
    account(pk: $accountPk) {
      id
      activeSubscription {
        basis
      }
      workspace(pk: $workspacePk) {
        id
        studies(states: [ORDERABLE]) {
          canCreateStudies: can(authorization: { action: CREATE }) {
            value
          }
        }
      }
    }
  }
}```

标签: angulargraphql

解决方案


推荐阅读