D
D
Dmitry2019-07-25 16:15:46
JavaScript
Dmitry, 2019-07-25 16:15:46

How to track the status of apollo consumer?

Good afternoon. there is such a request and I need to track its status in order to hang up the preloader if the request is pending

const DownloadTicketAnyFormat = ({ id, query, pathToLink, title }) => (
  <ApolloConsumer>
    {client => (
      <span id={id} onClick={async e => {
        const { data } = await client.query({
          query: query,
          variables: {
            id: e.target.id
          }
        })
        await window.open(data.seasonTicket[pathToLink].publicLink);
      }}>{title}</span>
    )}
  </ApolloConsumer>
)

tell me how can i do that? in a simple request through the Query tag, I know there is notifyOnNetworkStatusChange, but if the request is on an event (click), then this is an apollo consumer, but I can’t figure out how.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question