connectedState.ts 594 B

12345678910111213141516
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { ApolloLink } from '@apollo/client/core'
  3. import { recordCommunicationSuccess } from '#shared/server/connection.ts'
  4. // This link is only there to look for received responses and set
  5. // the applicationConnected state accordingly.
  6. const connectedStateLink = new ApolloLink((operation, forward) => {
  7. return forward(operation).map((response) => {
  8. // A response in this chain means there was no network error.
  9. recordCommunicationSuccess()
  10. return response
  11. })
  12. })
  13. export default connectedStateLink