Skip to content

Commit

Permalink
Fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed Dec 19, 2024
1 parent 7a26db6 commit 3d9cf21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions website/docs/api/clients/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,11 @@ const stream = new ShapeStream({
},
onError: async (error) => {
if (error instanceof FetchError && error.status === 401) {
// Force token refresh or handle specific auth errors
// Force token refresh
await refreshToken()
// The next request will automatically get a fresh token via the function-based header
// Return empty object to trigger a retry with the new token
// that will be fetched by our function-based header
return {}
}
// Rethrow errors we can't handle
throw error
Expand Down

0 comments on commit 3d9cf21

Please sign in to comment.