@axcode/axcloud-sdk 0.1.7-dev.cc5cc69 → 0.2.0-dev.03fb26c

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.mjs CHANGED
@@ -2153,7 +2153,7 @@ function ProtectedRoute({
2153
2153
  returnTo
2154
2154
  }) {
2155
2155
  const { isAuthenticated, isLoading: isAuthLoading, login } = useAuth();
2156
- const { user, role, isLoading: isUserLoading } = useUser();
2156
+ const { role, isLoading: isUserLoading } = useUser();
2157
2157
  const isLoading = isAuthLoading || isAuthenticated && isUserLoading;
2158
2158
  if (isLoading) {
2159
2159
  return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent ?? /* @__PURE__ */ jsx(DefaultLoadingComponent, {}) });
@@ -2165,9 +2165,9 @@ function ProtectedRoute({
2165
2165
  }
2166
2166
  return /* @__PURE__ */ jsx(Fragment, { children: unauthenticatedComponent ?? /* @__PURE__ */ jsx(DefaultUnauthenticatedComponent, {}) });
2167
2167
  }
2168
- if (roles && role) {
2168
+ if (roles) {
2169
2169
  const requiredRoles = Array.isArray(roles) ? roles : [roles];
2170
- const hasRequiredRole = requiredRoles.includes(role);
2170
+ const hasRequiredRole = role !== null && role !== void 0 && requiredRoles.includes(role);
2171
2171
  if (!hasRequiredRole) {
2172
2172
  return /* @__PURE__ */ jsx(Fragment, { children: unauthorizedComponent ?? /* @__PURE__ */ jsx(DefaultUnauthorizedComponent, {}) });
2173
2173
  }