From 3d9cf21111d3865aca5af74e3dce4cbe8cf29245 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Thu, 19 Dec 2024 10:27:25 -0700 Subject: [PATCH] Fix example --- website/docs/api/clients/typescript.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/website/docs/api/clients/typescript.md b/website/docs/api/clients/typescript.md index 7784405a28..76988dae59 100644 --- a/website/docs/api/clients/typescript.md +++ b/website/docs/api/clients/typescript.md @@ -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