Skip to content

Commit fed80d4

Browse files
committed
Add back code example
1 parent c7e01f8 commit fed80d4

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

docs/source/api/link/apollo-link-retry.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ Instead of the options object, you may pass a function for `delay` and/or `attem
3030

3131
The `attempts` function should return a `boolean` (or a `Promise` which resolves to a `boolean`) indicating whether the response should be retried. If yes, the `delay` function is then called, and should return the number of milliseconds to delay by.
3232

33+
```ts
34+
import { RetryLink } from "@apollo/client/link/retry";
35+
36+
const link = new RetryLink({
37+
attempts: (count, operation, error) => {
38+
return !!error && operation.operationName != "specialCase";
39+
},
40+
delay: (count, operation, error) => {
41+
return count * 1000 * Math.random();
42+
},
43+
});
44+
```
45+
3346
## Types
3447

3548
<InterfaceDetails

0 commit comments

Comments
 (0)