2

I have a simple query (Apollo-Angular Client) to fetch some data from an GraphQL server

  public getQuestionBank(courseCode: string): Observable<ApolloQueryResult<{}>> {
    const query = gql`
    query GetQuestionsQuery($courseCode: String!) {
      questions(courseCode: $courseCode) {
        questions
        status
      }
    }
  `;
  console.log(`GETTING QUESTIONS FOR: ${courseCode}`);
  return this.apollo.query({
    query: query,
    variables: {
      courseCode: courseCode
    },
    errorPolicy: 'all',
    context: {
      headers: new HttpHeaders().set('Authorization', this.user.Token)
    }
  });
}

The console.log is triggered but the request is never received at the server I use a similar type of query to login which works

  public login(email: string, password: string): Observable<ApolloQueryResult<{}>> {
    const query = gql`
    query TeacherLoginQuery($email: String!, $password: String!) {
      teacherLogin(email: $email, password: $password) {
        id
        email
        admin
        token
        name
        status {
          code
        }
      }
    }
  `;

  return this.apollo.query({
    query: query,
    variables: {
      email: email,
      password: password
    },
    errorPolicy: 'all',
  });
}

I have a morgan logger on the server and no request is received

BLaZeKiLL
  • 21
  • 2

1 Answers1

0

I had the same issue, reseting the client store worked for me.

await this.apollo.client.resetStore();

Gan
  • 937
  • 8
  • 22