-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy path+Page.mdx
More file actions
28 lines (18 loc) · 794 Bytes
/
Copy path+Page.mdx
File metadata and controls
28 lines (18 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Link } from '@brillout/docpress'
**Environment**: client.
The `onAbort()` hook is called whenever the browser makes a telefunction call that fails because the telefunction ran <Link text={<code>throw Abort()</code>} href="/Abort" />.
It does **not** run when other errors are thrown, see <Link href="/abort-vs-error" />.
```ts
// 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 implementing `getContext()` permission wrappers, see <Link href="/permissions#getcontext-wrapping" doNotInferSectionTitle={true} />.
## See also
- <Link href="/permissions" />
- <Link href="/Abort" />