connectedState.ts 595 B

1234567891011121314151617
  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