0

I have an SPA which makes various http calls to get content from third party service and show content on the page. How do I configure /use sw-toolbox and sw-precache libraries, such that if http call fails due to being offline it shows a custom 404 page.

happy
  • 39
  • 6

1 Answers1

0

you can achieve this b specifying a default router using

toolbox.router.default = "yourDefaultRoute";

more information on this can be found here : https://googlechrome.github.io/sw-toolbox/usage.html#the-default-route

Arya McCarthy
  • 8,554
  • 4
  • 34
  • 56
Peter Ugah
  • 11
  • 2
  • defaultRoute works when the page being rendered is not available. My scenario is that the page (which is already cached) is making an internal http call which returns a 404 and is handled by the catch of the promise. I want to show a custom 404 from the catch. – happy May 23 '17 at 00:27