@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 +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -126,6 +126,9 @@ function useChat({
|
|
|
126
126
|
signal: abortControllerRef.current.signal
|
|
127
127
|
});
|
|
128
128
|
if (!response.ok) {
|
|
129
|
+
if (response.status === 401 && typeof window !== "undefined") {
|
|
130
|
+
window.dispatchEvent(new CustomEvent("crow:token-refresh-needed"));
|
|
131
|
+
}
|
|
129
132
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
130
133
|
}
|
|
131
134
|
const reader = response.body?.getReader();
|
|
@@ -399,6 +402,9 @@ function useChat({
|
|
|
399
402
|
})
|
|
400
403
|
});
|
|
401
404
|
if (!response.ok) {
|
|
405
|
+
if (response.status === 401 && typeof window !== "undefined") {
|
|
406
|
+
window.dispatchEvent(new CustomEvent("crow:token-refresh-needed"));
|
|
407
|
+
}
|
|
402
408
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
403
409
|
}
|
|
404
410
|
const reader = response.body?.getReader();
|