@visns-studio/visns-components 6.5.1 → 6.5.2
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/package.json
CHANGED
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
92
92
|
},
|
|
93
93
|
"name": "@visns-studio/visns-components",
|
|
94
|
-
"version": "6.5.
|
|
94
|
+
"version": "6.5.2",
|
|
95
95
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
96
96
|
"main": "src/index.js",
|
|
97
97
|
"files": [
|
|
@@ -121,6 +121,13 @@ const GenericAuth = ({
|
|
|
121
121
|
const [isClientAuthenticated, setIsClientAuthenticated] = useState(false);
|
|
122
122
|
|
|
123
123
|
const updateAuthStatus = async () => {
|
|
124
|
+
// Guards must not act while the profile check is in flight: after a
|
|
125
|
+
// login flips isAuthenticated this re-runs, and a route evaluated
|
|
126
|
+
// against the half-updated state bounced dashboard → /login →
|
|
127
|
+
// dashboard. Loading renders AuthLoading instead, so the user sees
|
|
128
|
+
// one spinner and one navigation.
|
|
129
|
+
setIsLoading(true);
|
|
130
|
+
|
|
124
131
|
try {
|
|
125
132
|
const { data } = await CustomFetch('/ajax/user/profile', 'GET');
|
|
126
133
|
|
|
@@ -135,7 +142,15 @@ const GenericAuth = ({
|
|
|
135
142
|
}
|
|
136
143
|
} catch (error) {
|
|
137
144
|
setIsLoading(false);
|
|
138
|
-
|
|
145
|
+
// Was `'Unauthenticatdata.'` — a typo no server response ever
|
|
146
|
+
// matches, so this redirect had been dead code since it was
|
|
147
|
+
// written and unauthenticated bounces were left to the route
|
|
148
|
+
// guard alone.
|
|
149
|
+
if (
|
|
150
|
+
['Unauthenticated.', 'CSRF token mismatch.'].includes(
|
|
151
|
+
String(error)
|
|
152
|
+
)
|
|
153
|
+
) {
|
|
139
154
|
const currentUrl = window.location.pathname;
|
|
140
155
|
|
|
141
156
|
setIsAuthenticated(false);
|