-2

I'd like to redirect to an error page when my GraphQL API is down instead of showing an empty page because the content couldn't load. enter image description here

I think I have to do the redirection when Apollo receives an error 503 as a reply but I don't know how I can do that.

Thank you !

anegru
  • 1,023
  • 2
  • 13
  • 29

1 Answers1

0

You can handle the error with this, in your apollo query.

 apollo: {
    todos: {
      query: GET_MY_TODOS,
      error(error) {
      console.log(error)
      this.$router.push('/db-error-page')
     }
    },
  },
Ignacio
  • 116
  • 4