I am late to the party, but I found a better solution to this issue.
If you aim to check if the user is offline, you can do that by using navigator.onLine
on the catch.
.catch((error) => {
if(!navigator.onLine) {
handleOffline()
}
})