onAbort()
Environment: client.
The onAbort()
hook is called whenever the browser makes a telefunction call that fails because the telefunction ran throw Abort()
.
// Environment: client
import { onAbort } from 'telefunc/client'
onAbort(err => {
if (err.abortValue.notLoggedIn) {
// Redirect user to login page
window.location.href = '/login'
}
})
The
onAbort()
hook is usually used for implementinggetContext()
wrappers, see Guides > Permissions >getContext()
wrapping.