@usecrow/ui 0.1.22 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -152,6 +152,9 @@ function useChat({
152
152
  signal: abortControllerRef.current.signal
153
153
  });
154
154
  if (!response.ok) {
155
+ if (response.status === 401 && typeof window !== "undefined") {
156
+ window.dispatchEvent(new CustomEvent("crow:token-refresh-needed"));
157
+ }
155
158
  throw new Error(`HTTP error! status: ${response.status}`);
156
159
  }
157
160
  const reader = response.body?.getReader();
@@ -425,6 +428,9 @@ function useChat({
425
428
  })
426
429
  });
427
430
  if (!response.ok) {
431
+ if (response.status === 401 && typeof window !== "undefined") {
432
+ window.dispatchEvent(new CustomEvent("crow:token-refresh-needed"));
433
+ }
428
434
  throw new Error(`HTTP error! status: ${response.status}`);
429
435
  }
430
436
  const reader = response.body?.getReader();