@replicated/portal-components 0.0.22 → 0.0.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/components/metadata/registry.json +2 -2
- package/components/metadata/registry.md +2 -2
- package/dist/esm/index.js +16 -18
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/index.js +15 -17
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/index.js +16 -18
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +15 -17
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -121,7 +121,7 @@ var init_tracer = __esm({
|
|
|
121
121
|
|
|
122
122
|
// package.json
|
|
123
123
|
var package_default = {
|
|
124
|
-
version: "0.0.
|
|
124
|
+
version: "0.0.23"};
|
|
125
125
|
|
|
126
126
|
// src/tokens/index.ts
|
|
127
127
|
var baseTokens = {
|
|
@@ -532,24 +532,22 @@ async function validateSession(token) {
|
|
|
532
532
|
if (!token || typeof token !== "string" || !token.trim()) {
|
|
533
533
|
return false;
|
|
534
534
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
} catch (error) {
|
|
550
|
-
console.warn("[portal-components] session validation error:", error);
|
|
551
|
-
return true;
|
|
535
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/user`;
|
|
536
|
+
const response = await fetch(endpoint, {
|
|
537
|
+
method: "GET",
|
|
538
|
+
headers: {
|
|
539
|
+
authorization: `Bearer ${token}`
|
|
540
|
+
},
|
|
541
|
+
// Short timeout for validation
|
|
542
|
+
signal: AbortSignal.timeout(5e3)
|
|
543
|
+
});
|
|
544
|
+
if (response.status === 401) {
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
if (!response.ok) {
|
|
548
|
+
throw new Error(`Session validation failed with status ${response.status}`);
|
|
552
549
|
}
|
|
550
|
+
return true;
|
|
553
551
|
}
|
|
554
552
|
async function deleteSessionCookie() {
|
|
555
553
|
const { cookies: cookies2 } = await import('next/headers');
|