We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4c6afb2 commit 32eca80Copy full SHA for 32eca80
packages/react/src/context/ComlinkTokenRefresh.tsx
@@ -66,6 +66,21 @@ function DashboardTokenRefresh({children}: PropsWithChildren) {
66
67
if (res.token) {
68
setAuthToken(instance, res.token)
69
+
70
+ // Remove the unauthorized error from the error container
71
+ const errorContainer = document.getElementById('__sanityError')
72
+ if (errorContainer) {
73
+ const hasUnauthorizedError = Array.from(errorContainer.getElementsByTagName('div')).some(
74
+ (div) =>
75
+ div.textContent?.includes(
76
+ 'Uncaught error: Unauthorized - A valid session is required for this endpoint',
77
+ ),
78
+ )
79
80
+ if (hasUnauthorizedError) {
81
+ errorContainer.remove()
82
+ }
83
84
}
85
isTokenRefreshInProgress.current = false
86
} catch {
0 commit comments